Win a copy of Head First Android this week in the Android forum!
  • 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
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

which layout manager to use

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
I've 4 comboboxes, 4 labels for comboboxes and one text field and two buttons. I am planning to add all these to panel. I'll add panel to a frame. I'm planning to use borderlayout for frame. Which layout manager will be suitabel for panel, if I add the above specified components to it. I don't want to use absolute positioning...since components will get disturbed with resizing. I think even flowlayout will not be appropriate. All suggestions will be appreciated.
Thanks,
Srilatha.
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Shrilata,
I too faced a similar problem and being an anateur I found layout managers a hopeless part of Java.
But the panelname.setLayout(null) is ideal and gives great looks as you can place components where desired and resizing of frame/window does not affect the components.
The components can be placed by using setBounds as in
Yourcomponent.setBounds(x,y,width,height) and then adding the component to the panel by saying panelname.add(yourcomponent)
Regards,
Ameet
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi srilatha,
can u tell me how u are going to place the components.
i suggest u to use separate panel for combobox, separate panel for label and use vertical layout(avialable free in the net).
Add the two panels to an outer panel in east and west.in another panel add the textfield to the center.
Add the two buttons in a separate panel using flowlayout.add this panel and textfield panel to another panel in north and south.
Add the 2 outer panel to an another outer panel in north and south.
Add this panel to the frame in center.
If u want the vertical layout class, mail me to this id
-sashkamal@lycos.com
bye.

------------------
sashkamal
 
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by srilatha malip:
Hi all,
I've 4 comboboxes, 4 labels for comboboxes and one text field and two buttons. I am planning to add all these to panel. I'll add panel to a frame. I'm planning to use borderlayout for frame.
Thanks,
Srilatha.


Hi,
I would add each Combobox with its Label to a Panel with a FlowLayout. I asume the two buttons are a "Ok" and a "Cancel" Button. So I would add this two buttons also to a panel with a
Flowlayout. For the main Panel I would use a GridLayout with five rows. Next I would add all Panels and the TextField in the desired order to the main Panel. Or perhaps you like to seperate the Ok/Cancel Panel from the oders by using another Panel with a BorderLayout (adding the Ok/Cancel Panel to NORTH and the GridLayout Panel to CENTER).
I am also an amateur. It tooks some time to unterstand how to use the LayoutManagers and to recognice the different advantages but i think its worthy to learn.
Hope this helps.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic