• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

help please?

 
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I need to have the text box in first row and underneath that two panels that are next to each other. With the code below, I keep getting each panel underneath each other. How do I get two rows so that in first row, I have the text box and the second row, two panels next to each other?
Manfred helped a little with this, but not completely. Thanks for your help....

 
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Brian,
If you want a different number of items on each row then you must either use GridBagLayout or make use of more than one GridLayout. For example: place your p2 and p3 into a 1 row, 2 column GridLayout:
Panel p4 = new Panel( new GridLayout(1,0) );
p4.add( p2 );
p4.add( p3 );
Then use top panel having 1 column to place them:
add( p1 ); // First row
add( p4 ); // Second row
If you want to play with borders and insets then you need to go ahead and use GridBagLayout.
Good Luck,
Manfred.
 
Brian Snyder
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Manfred. That was a big help.
Sometimes things seem so obvious after some help. Many thanks.
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i feel u may change ur layout,like gridBagLayout or make the
freme's layout as null.u can use setBounds() method after
setting it to null.
 
Manfred Leonhardt
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Jinu,
You should only use the null layout as a last resort! It doesn't provide any functionality for layout changes (i.e., window being resized). As a UI developer, I would be dead set against EVER using null layout. If you don't want to learn the layouts then you shouldn't be using Java to develop apps ... just my opinion.
Regards,
Manfred.
 
reply
    Bookmark Topic Watch Topic
  • New Topic