Restrictions on JPanel, Java?
I have followed a sun tutorial to create a JTabbedPane. The example i followed extends a JPanel. Now within the code, i have this
private static void createAndShowGUI() {
JFrame frame = new JFrame("MEET_dataTable");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOS E);
frame.add(new Meet(), BorderLayout.CENTER);
frame.pack();
frame.setVisible(true);
}
Which adds the JPanel to a JFrame and packs it. But now on trying to do a few things and then researching, it appears that extending a JPanel has a few restrictions. The first thing is that it seems that dispose does not work on a JPanel when i use this.dispose(); So for the time being i have just used System.exit(0); but is there a better way to dispose than this?
My main problem though is that i have a button which when pressed should call up another gui. So i created an instance of it and then in the actionPerformed i done
private void save_actionPerformed()
{
meet = New Meet();
}
but when the button is pressed nothing comes up. I have tried passing it a Father Frame which also didnt do anything. Is bringing up another gui through an event done differently using JPanels?
cheers
|