I just worked it out and I can't believe it! I'm so sorry guys haha.
Turns out the image was actually a bmp, it just had the file extension of png. WOOOOPS!
Thanks very much to everyone who...
Type: Posts; User: mohagan9
I just worked it out and I can't believe it! I'm so sorry guys haha.
Turns out the image was actually a bmp, it just had the file extension of png. WOOOOPS!
Thanks very much to everyone who...
Project Folder:
>src
>>(default package) - //java files here//
>>images - //image here//
>jre
>images - //image here//
Thanks for the reply, but still a blank screen :(
Line is as follows: backgroundImage = new ImageIcon(getClass().getResource("/images/splash_screen.png"));
My structure is as follows for...
Yup there is a red square, but the image is being located. I've tested for that already. Why should putting the image in my src folder make a difference?
Having said that there was one little...
File directory is fine.
I moved gameWindow.setVisible(true); to after the line gameWindow.add(splashScreen.getContent()); but it didn't make a difference.
Here's the output:
javax.swing.JPanel[,0,0,800x600,invalid,layout=java.awt.FlowLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=9,maximumSize=,minimumSize=,preferredSize=]
Thanks for testing it! Here's my structure:
Project Folder:
>src >>default package
>jre
>splash_screen.png
Using setBounds and the panel is within bounds of the JFrame. Doesn't help, just a blank JFrame.
Hey, I was hoping someone could point out why my image may not be showing. Note I am using eclipse.
Window.java:
import javax.swing.*;
public class Window
{
private JFrame gameWindow;