Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: How to handle Group Layout Manually

  1. #1
    Junior Member
    Join Date
    Nov 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default How to handle Group Layout Manually

    How to handle Group Layout Manually without using Layout manager.

    I'm dealing with this piece of code
    how to set sizes, locations etc manually i'm new to these layouts.


    GroupLayout jPanel2Layout = new GroupLayout(jPanel2);
    jPanel2.setLayout(jPanel2Layout);
    jPanel2Layout.setHorizontalGroup(
    jPanel2Layout.createParallelGroup(GroupLayout.Alig nment.LEADING)
    .addGroup(jPanel2Layout.createSequentialGroup()
    .addContainerGap()
    .addGroup(jPanel2Layout.createParallelGroup(GroupL ayout.Alignment.LEADING)
    .addGroup(GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
    .addComponent(Add)
    .addGap(54, 54, 54))
    .addGroup(GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
    .addComponent(search)
    .addGap(24, 24, 24))
    .addGroup(jPanel2Layout.createSequentialGroup()
    .addComponent(Info)
    .addPreferredGap(LayoutStyle.ComponentPlacement.RE LATED, 89, Short.MAX_VALUE))
    .addGroup(jPanel2Layout.createSequentialGroup()
    .addComponent(Locate)
    .addPreferredGap(LayoutStyle.ComponentPlacement.RE LATED, 99, GroupLayout.PREFERRED_SIZE))
    .addGroup(GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
    .addGap(28, 28, 28)
    .addComponent(Add, GroupLayout.DEFAULT_SIZE, 122, Short.MAX_VALUE)
    .addGap(14, 14, 14))
    .addGroup(GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
    .addGap(28, 28, 28)
    .addComponent(search, GroupLayout.DEFAULT_SIZE, 136, Short.MAX_VALUE))
    .addGroup(jPanel2Layout.createSequentialGroup()
    .addComponent(view)
    .addPreferredGap(LayoutStyle.ComponentPlacement.RE LATED, 89, Short.MAX_VALUE))
    .addGroup(GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
    .addGroup(jPanel2Layout.createParallelGroup(GroupL ayout.Alignment.LEADING)
    .addComponent(Of)
    .addComponent(On))
    .addGap(31, 31, 31)))
    .addContainerGap())
    );


  2. #2
    Super Moderator jps's Avatar
    Join Date
    Jul 2012
    Posts
    2,642
    My Mood
    Daring
    Thanks
    90
    Thanked 263 Times in 232 Posts

    Default Re: How to handle Group Layout Manually

    Group Layout is a layout manager, see the tutorial here
    ...or try Grid Bag layout

    If you still have problems, explain what it is you want to do and what problems you are having. Reading over code that does not do what you want it to do does not explain much.

  3. #3
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: How to handle Group Layout Manually

    Also posted at: Handel Group Layout
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. SWT- one Group taking all space vertically and hides other group in compoiste
    By Rajesh Prabhu in forum What's Wrong With My Code?
    Replies: 1
    Last Post: October 25th, 2013, 04:54 AM
  2. Help with Group Layout
    By GoPro in forum What's Wrong With My Code?
    Replies: 1
    Last Post: April 1st, 2012, 09:34 PM
  3. Help with manually stepping through these loops
    By u-will-neva-no in forum Loops & Control Statements
    Replies: 1
    Last Post: February 20th, 2012, 04:45 AM
  4. Replies: 1
    Last Post: April 14th, 2011, 07:50 AM
  5. setting cookies manually
    By dotanguy in forum Java Networking
    Replies: 2
    Last Post: July 2nd, 2010, 09:51 AM