Forums Login/signup

Adding a new page to my contaier.

+Pie Number of slices to send: Send
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.

+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
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?
+Pie Number of slices to send: Send
Make CenterPanel a JPanel and add a JTabbedPane to it.
+Pie Number of slices to send: Send
Thank you very much for the reply's!

I am receiving a run time error message

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)
+Pie Number of slices to send: Send
in my first reply I had this
"CenterPanel is a JFrame"

nothing has changed
"public class CenterPanel extends JFrame "

reply
reply
This thread has been viewed 1475 times.
Similar Threads
missing components
Help i need help with borderlayout
HELLP! i cant get 2 JPanels to display without them sitting on the other!
JComboBox problem...
JScrollpane problem
More...

All times above are in ranch (not your local) time.
The current ranch time is
Jun 27, 2025 20:01:56.