jPanel in a jFrame problem.

Soldato
Joined
2 Nov 2002
Posts
3,304
Location
Aberdeen
Well, basically, i have a Jpanel which i can draw on. called SetColourPanel.java

I also have a Jframe to which consists of a north and center panel. The north containing a jbutton which changes the colouring of the lines, called SetColourFrame.java

The problem i'm having is trying to run SetColourFrame.java. I thought if i used

Code:
    public SetColourFrame() {
        this.myColourPanel = new SetColourPanel();
        this.getContentPane().add(myColourPanel,java.awt.BorderLayout.CENTER);
        initComponents();

That would add my panel to the center of the panel but it's not.

The errors i'm recieving are..
Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: adding a window to a container


If you need to see more code feel free to ask, just i'm not too sure where i've gone wrong here.

Cheers
 
Back
Top Bottom