I am trying to add a page I created, called "CenterPanel.java" to the CENTER position of my containter page. (IntroPanel.Java)
Here is my MAIN.
Here is my containter.. this is where I would like to add CenterPanel.Java into the CENTER position of my borderlayout
THIS is the page I am trying to add into my "IntroPanel.java" BorderLayout.CENTER position.
Bonus page, PizzaPanel.Java.. I am trying to add this to a tab on my CenterPanel.java page.
Michael Dunn
Ranch Hand
Joined: Jun 09, 2003
Posts: 4632
posted
0
add (centerpanel, BorderLayout.CENTER); ///////////////// HELP ME HERE???
if centerpanel is an instance of the class CenterPanel, you can't.
CenterPanel is a JFrame, so it cannot be added to a container.
You'll have to change anything to do with frames to JPanels
david weatherholt
Greenhorn
Joined: May 03, 2012
Posts: 3
posted
0
Is there any way I can make my CenterPanel have a set of tabbed panels inside of it? Even though I want to add it to my IntroPanel.java's BorderLayout.CENTER?
Exception in thread "main" java.lang.IllegalArgumentException: adding a window t
o a container
at java.awt.Container.checkNotAWindow(Container.java:483)
at java.awt.Container.addImpl(Container.java:1084)
at java.awt.Container.add(Container.java:966)
at IntroPanel.<init>(IntroPanel.java:44)
at PizzaLab.main(PizzaLab.java:25)
Press any key to continue . . .
I believe my CenterPanel.java code is messed up... I am trying to add tabs to my other pages, PizzaPanel and DrinksPanel.
Here is my CenteraPanel.java code..
(Code commented off , not using it, just there playing with it... trying to figure it out)
Michael Dunn
Ranch Hand
Joined: Jun 09, 2003
Posts: 4632
posted
0
in my first reply I had this
"CenterPanel is a JFrame"
nothing has changed
"public class CenterPanel extends JFrame "
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.