This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes JFrame not displaying text. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JFrame not displaying text." Watch "JFrame not displaying text." New topic
Author

JFrame not displaying text.

David Irwin
Ranch Hand

Joined: Mar 25, 2004
Posts: 82
I have a JFrame where I'm displaying some simple text information in a JPanel. However, when the application starts up the text is not displayed until I resize the frame. I imagine I'm initializing the frame incorrectly but is there something obvious that I'm not doing?

Example:


The method call builds a JPanel with the text to be displayed.

Thanks for the help.
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24189
    
  34

If you're adding these components after the JFrame has already appeared on the screen, then you need to call validate() on the JFrame to get its contents to appear. Alternatively, you can set the whole GUI up before you call setVisible on the JFrame.


[Jess in Action][AskingGoodQuestions]
 
Have you checked out Aspose?
 
subject: JFrame not displaying text.
 
It's not a secret anymore!