This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes JFrame doesnt display image until it is resized Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JFrame doesnt display image until it is resized" Watch "JFrame doesnt display image until it is resized" New topic
Author

JFrame doesnt display image until it is resized

Sanjeev Mehta
Greenhorn

Joined: Feb 13, 2009
Posts: 12
I have written a simple code with a JFrame displaying an image. The problem I am facing is that the image does not appear when I execute the code. At first the JFrame is blank. If I now resize the JFrame, the image is displayed. Could you guys help me figure out the problem please.

Please find my code below
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2157
    
    7
Works fine for me using JDK6 on XP.

Why don't you read the section from the Swing tutorial on "How to Use Icons" and download the example from there to see if it works properly in your environment.
Sanjeev Mehta
Greenhorn

Joined: Feb 13, 2009
Posts: 12
I was on JDK5. Upgraded to JDK 6 now and it works fine.
Thanks.
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10175
    
    8

Lazy Me wrote:

Please check your private messages for an important administrative matter


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: JFrame doesnt display image until it is resized
 
Similar Threads
Adding an image to a frame
running gifs
JLabel , image
How to add image inside jPanel ??
panel and image problem