aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Show JPanel in another class HELP !!!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Show JPanel in another class HELP !!!!" Watch "Show JPanel in another class HELP !!!!" New topic
Author

Show JPanel in another class HELP !!!!

Rich Charlton
Greenhorn

Joined: Nov 11, 2004
Posts: 19
Hi,

I have two classes, one with a main method that displays a main frame. and another which makes a JPanel which i would like to display on the main frame in the other class. I have it working and compiling but not really showing on the main frame like i want it. It shows in the main frame as a very small square grey box.

Main Frame Program called testpanel:


Second Class called addpanel.


I need to be able to see the JPanel made in the second class in the main frame made in the first class, if that makes any sense.

Can anyone help me please !

Thanks
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
in addpanel(), you're creating a number of components and adding them to
typeinfo, but it is not typeinfo being added to testpanel, it is an instance
of addpanel. You need to add typeinfo to addpanel

at the end of the addpanel constructor

Rich Charlton
Greenhorn

Joined: Nov 11, 2004
Posts: 19
Hi,

Yeh this has worked.

Thanks
 
 
subject: Show JPanel in another class HELP !!!!