abcde
abcde

Reputation: 23

Image object in windows vista (Java)

I am trying to add a background image to my GUI (on java). All the commands for GUI I got from my university..

try {
    Image image = ImageIO.read(Background.class.getResourceAsStream("myBackground.jpg"));
} catch (Exception e) {
    e.printStackTrace();
}
DrawSurface d = ... (commands from university jar)
d.drawImage(0, 0, image);

I see the background when I run it (as a jar) on Windows XP.

I don't see the background when I run it (the same jar) on Windows Vista (Without any exception! ), so I think it may be something with Vista settings..

How can I fix it?

Upvotes: 0

Views: 39

Answers (1)

Zesty Memes
Zesty Memes

Reputation: 442

Simple Answer

Don't use Vista.

Less Simple Answer

More than likely, one of two things is happening in your University's code:

  • The code is attempting to draw straight to a JComponent, and it is not being called correctly by the System, because of how Vista handles internal repaint() calls.
  • Your school's code has a feature in it that is not hardware independent. Go figure.

Upvotes: 1

Related Questions