Problem extending JFrame with JTabbedPane in it
Hi!
I want to use one JFrame with JTabbedPane in it as a prototype for the few other forms (frames) and got the following code for this prototype:
Code:
public class ProtoForm extends JFrame
{
JTabbedPane tabbedPane;
JPanel p1;
JPanel p2;
public ProtoForm()
{
super();
setBounds(100, 100, 500, 375);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
tabbedPane = new JTabbedPane();
getContentPane().add(tabbedPane);
panel = new JPanel();
tabbedPane.addTab("Main panel", null, panel, null);
panel = new JPanel();
tabbedPane.addTab("Main panel", null, panel, null);
}
}
Here is a code for the extending (inheriting) form:
Code:
public class NewForm extends ProtoForm
{
public NewForm()
{
super();
setBounds(100, 100, 500, 375);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
The very same code works without any problems when I put JButton's or JTextField's. But JTabbedPane seems to be not inheritable yet :).
If anyone had same problem or knows how to solve it please leave a message.