I am developing one java desktop application with a lots of panels with different and same layouts. Now when I want to set to panel new layout I always create new layout. E.G.
JPanel panel = new JPanel(new GridLayout(0, 1));
Is the correct solution to create some LayoutFactory and here create all the layouts that I need and then set to the panels?
1) laying JPanel by new
GridLayout(0, 1)should be same asBorderLayout.CENTERor possible by usingBoxLayout, in this case you place only oneJComponentfor wholeJPanel2) easiest way is lay
JComponentsbyNested Layoutwhere each of Container can have different LayoutManager, sameLayoutManageror their combinations3) by using GridBagLayout or MigLayout is possible (in most of cases) place every
JComponentsonce time for whole container orJPanel