I'm not sure how to word this, but I did my best in the title. I'm creating a GUI and for simplicity it has a frame, a tabbed pane, a panel, and a button. Originally, they started in the same class, but I want to try splitting them into two classes.
So now I have this...
import FirstPanel.java public class GUI extends JFrame{ private JFrame frame; private JTabbedPane tabs; private FirstPanel firstPanel; //Constructor public GUI(){ frame = new JFrame(); tabs = new JTabbedPane(); firstPanel = new FirstPanel(); tabs.add("Tab #1", firstPanel); frame.add(tabs); //Set frame visible and the size etc... } public static void main(String[] args){ GUI gui = new GUI(); gui.setVisible(true); }
What is FirstPanel? It's the second class!
The output I am looking for is a frame with a tab with a panel with a button.
Now, when I run GUI, I get a frame with a tab with a panel but there is no button displayed. I thought at first that it was because all components need to be in the same class, but I dismiss that because I am at least getting ONE panel.
I get no errors or output from this, only a missing button.
Any help is greatly appreciated!
Cheers!
-Polaris395