Question about layout in java.

Posted by extro on Stack Overflow See other posts from Stack Overflow or by extro
Published on 2010-03-29T17:38:41Z Indexed on 2010/03/29 17:43 UTC
Read the original article Hit count: 300

Filed under:

I have two panels main_panel and child_panel. I have set layout for main_panel by using "main_panel.setLayout(flowlayout)" and added child_panel in main_panel by using "main_panel.add(child_panel)". This child_panel gets added to main_panel but its position is at the cross-section of horizontal midpoint and top vertical section of screen. But I want child_panel to be at the top left corner, something I could have done by using "child_panel.setlocation(a,b)" method, if I have set the Layout of main_panel as NULL. I have used flowlayout here because I want components in the JPanel to keep adjusting with the size of JFrame. So question is, can I add child_panel to main_panel at the exact location I want, even if I set the Layout of main_panel as not NULL.

© Stack Overflow or respective owner

Related posts about java