This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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 agree. Here's the link: http://aspose.com/file-tools
 
subject: Getting a Component to show?
 
Similar Threads
Can't see my Panels!!! Aaarrghhhhh....
Transparent color for the panel !
Refreshing JLabel
JTable - Renderer for JPanel
JLabel Word Wrap