It's not a secret anymore!
The moose likes Swing / AWT / SWT and the fly likes Getting a Component to show? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Getting a Component to show?" Watch "Getting a Component to show?" New topic
Author

Getting a Component to show?

James Hodgkiss
Ranch Hand

Joined: Jan 22, 2004
Posts: 401
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

Joined: Feb 26, 2006
Posts: 194
Have you tried the repaint() method. A Code snippet would be more useful if you could share it.


-Sam Codean<br />SCJP 1.4 (98%)<br />SCJD 5.0 (87.5%)
James Hodgkiss
Ranch Hand

Joined: Jan 22, 2004
Posts: 401
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

Joined: Feb 26, 2006
Posts: 194
Congrats!! You cracked it ;-)
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: Getting a Component to show?
 
It's not a secret anymore!