I have a Swing window. At the top I have a drop down based on the drop down value selection specific content should display.
Which is the best layout to use?
I have a Swing window. At the top I have a drop down based on the drop down value selection specific content should display.
Which is the best layout to use?
Your question suggests that you are not very familiar with swing so i will suggest to go with the default layout which is FlowLayout.
The Swing window should have Border Layout. For the North constraint you should put your combo Box wrapped into a simple JPanel, which has a FlowLayout. Based on the ComboBox changes you will change the Center of your Swing window. Please see the sample code at http://docs.oracle.com/javase/tutorial/uiswing/layout/border.html
you will need this code in your combo box action:
button = new JButton("Button 2 (CENTER)");
button.setPreferredSize(new Dimension(200, 100));
pane.add(button, BorderLayout.CENTER);
I hope it helps.