• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting a Component to show?

 
James Hodgkiss
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My JApplet creates a JPanel and adds it to the display.

I then try to add a JLabel to that JPanel, but the JLabel doesn't show.

I've called validate() on the JPanel, but no change.

How can I get the JLabel to show?

Thanks,
James
 
Sam Codean
Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you tried the repaint() method. A Code snippet would be more useful if you could share it.
 
James Hodgkiss
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cheers for the reply.

I've sorted it now. Problem was that the method I created to do it was (stupidly) called add(), and it was calling Container's add method instead of my method - which is why it wasn't showing up...

Thanks again,
James
 
Sam Codean
Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Congrats!! You cracked it ;-)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic