This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Show JPanel in another class HELP !!!!

 
Rich Charlton
Greenhorn
Posts: 19
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4632
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 19
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Yeh this has worked.

Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic