Re: Jpanel background image issues



Gorilla3D wrote:
I am having trouble showing the background image onto a panel All the
JPanel code should be right but when I run the app, it just shows the
JFrame with no panel. There is no IOException when ran so it reads the
file with no problem.

NewJFrame.java
http://paste2.org/p/9818

ImagePanel.java
http://paste2.org/p/9819


Does anyone have and ideas?
Using: Java 1.6u3

You've got a couple of problems, first you add the ImagePanel after calling pack() on the container. I don't know how that layout manager works so there could be problems there. ImagePanel has no preferred size. That will probably make it difficult to layout.

See http://www.knutejohnson.com and look at the code for the ImageIOExample.

--

Knute Johnson
email s/nospam/knute/
.