Hi all,
Could someone explain what I am doing wrong with my classes that my JTabbedPane doesn't display when the JFrame.setvisible is set to true?
Yes, the main method of the program (which I won't put here) uses the event dispatching thread to initiate ArionGUI.
Here is my code for the JFrame:
import javax.swing.*;
public class ArionGUI extends JFrame {
public ArionGUI() {
// Set up GUI frame for Arion
JFrame arionFrame = new JFrame("Arion v 0.01");
// Add Arion Tabbed Pane
arionFrame.getContentPane().add(new ArionTabbedPane());
// Terminate the application when closed
arionFrame.setDefaultCloseOperation(EXIT_ON_CLOSE);
// Set the size of the frame
arionFrame.setSize(500, 500);
// Center window
arionFrame.setLocationRelativeTo(null);
// Prevent user from resizing window
arionFrame.setResizable(false);
// Make Arion frame visible on screen
arionFrame.setVisible(true);
}
}
And here is my code for the JTabbedPane:
import javax.swing.JTabbedPane;
import javax.swing.JLabel;
import javax.swing.JComponent;
public class ArionTabbedPane extends JComponent {
JTabbedPane arionTabbedPane;
public ArionTabbedPane() {
arionTabbedPane = new JTabbedPane(JTabbedPane.TOP);
arionTabbedPane.addTab("Characters", new JLabel("This is the characterz tab"));
arionTabbedPane.addTab("Miscellaneous", new JLabel("This is the miscellaneous tab"));
add(arionTabbedPane);
}
}