This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates 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 OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP 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: 2206
    
    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: 10491
    
    9

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!]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JFrame doesnt display image until it is resized