maybe typos mistake,check that again because one cotainer you can add just one, that standard how to lay GUI, nice way
hmmm these "panels" are declared (at all) as JPanels ???,
mKorbel
Veteran Poster
1,141 posts since Feb 2011
Reputation Points: 480
Solved Threads: 224
remove anything about container or ContentPane, that very old .... (set backGround Color for JFrame),
usage of container is worng, forgot about that, LayoutManaget solved that ..., don't forget set the PreferredSize for positions excepts Center (that works automatically),
hmmm
myFrame.add(somePanel, BorderLayout.WEST); NORTH, SOUTH..... CENTER
myFrame.pack();
myFrame.setVisible(true);
} //end of buid GUI
mKorbel
Veteran Poster
1,141 posts since Feb 2011
Reputation Points: 480
Solved Threads: 224
leftSide is the contentpane for the window (previous listing line 5)
bothSides is also the contentpane for the window (previous listing line 14)
so on line 17 you are trying to add the content pane to itself, == error.
At a guess, leftSide should be a new container.
JamesCherrill
Posting Genius
6,370 posts since Apr 2008
Reputation Points: 2,130
Solved Threads: 1,073
:-) yes your profesor had right, JFrame is Top Layout Container, and every todays Layout Managers automatically build place for JComponents based on ContentPane :-)
mKorbel
Veteran Poster
1,141 posts since Feb 2011
Reputation Points: 480
Solved Threads: 224
I made leftSide a container and that worked. I didn't realize that I hadn't done that in the first place. Thank you very much.
OK, glad to help. Mark this solved?
JamesCherrill
Posting Genius
6,370 posts since Apr 2008
Reputation Points: 2,130
Solved Threads: 1,073