J
Justin
I took an intro course to OOP 4 years ago, and I have been recently
getting back into it again. I have a JTabbedPane and I would like to
put a JFrame within a JTabbedPane. However, I am getting an error when
I add the JFrame to the JTabbedPane -
<font color="red">Exception in thread "main"
java.lang.IllegalArgumentException: adding a window to a container
</font><br><br>
I do this because I would like InternalFrames within the tabs.
I think the relevant code is here: <br><br>
<i>
public JPanel createNewTab(){
JPanel panel = new JPanel();
externalFrame = new JFrame();
//externalFrameMethod();
panel.add(externalFrame);
//panel.validate();
return panel;
}
</i><br><br>
The line that is causing the error is panel.add(externalFrame); line.
Any help would be greatly appreciated.
getting back into it again. I have a JTabbedPane and I would like to
put a JFrame within a JTabbedPane. However, I am getting an error when
I add the JFrame to the JTabbedPane -
<font color="red">Exception in thread "main"
java.lang.IllegalArgumentException: adding a window to a container
</font><br><br>
I do this because I would like InternalFrames within the tabs.
I think the relevant code is here: <br><br>
<i>
public JPanel createNewTab(){
JPanel panel = new JPanel();
externalFrame = new JFrame();
//externalFrameMethod();
panel.add(externalFrame);
//panel.validate();
return panel;
}
</i><br><br>
The line that is causing the error is panel.add(externalFrame); line.
Any help would be greatly appreciated.