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.
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
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 -firstname.lastname@example.org bye.
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