Positioning child panels using FlowLayout
- by extro
I have two panels:
main_panel
child_panel
The main_panel layout is set using:
main_panel.setLayout(flowlayout)
I then added child_panel to main_panel:
main_panel.add(child_panel)
The child_panel gets added to main_panel but its position is at the cross-section of horizontal midpoint and top vertical section of screen. 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 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?