My program looks like this!

I want to have the bottom part dynamically load a frame into the bottom frame depending on the item selected in the ComboBox. For example, if the first item is selected I want a panel from the PresentValue.java file displayed. The idea is that I have one java file for each selection that displays what I design in its respective java file.


These two java files should be put into the “bottom” box from my first screenshot, depending on the selection from the combobox.
I’m more used to Android programming and there I would simple call the replace method from fragments to swap out the fragment loaded… looking for the analogy here.
final JComboBox selectorBox = new JComboBox(selection);
selectorBox.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
int selectionID = selectorBox.getSelectedIndex();
}
});
but cant find a way to do what I want to do. Please explain.
For each Java file that you have, the output of that Java file should be a
JPanel. Not aJFrame.Before you display anything, execute all of the Java files you have. Create all of the possible
JPanels.Create your JFrame in your GUI, then use the remove and add methods of
JFrameto remove or add the desiredJPanel.Here’s an example from one of my GUI’s.
The setBounds method resets the bounds if the display
JPanelis bigger or smaller than the alarmJPanel.Your application should have one
JFrame. You use multipleJPanels to create your GUI.