Search:

Type: Posts; User: mohagan9

Search: Search took 0.11 seconds.

  1. Replies
    19
    Views
    21

    [SOLVED] Re: JFrame - ImageIcon not displaying

    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...
  2. Replies
    19
    Views
    21

    [SOLVED] Re: JFrame - ImageIcon not displaying

    Project Folder:

    >src
    >>(default package) - //java files here//
    >>images - //image here//

    >jre

    >images - //image here//
  3. Replies
    19
    Views
    21

    [SOLVED] Re: JFrame - ImageIcon not displaying

    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...
  4. Replies
    19
    Views
    21

    [SOLVED] Re: JFrame - ImageIcon not displaying

    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...
  5. Replies
    19
    Views
    21

    [SOLVED] Re: JFrame - ImageIcon not displaying

    File directory is fine.
    I moved gameWindow.setVisible(true); to after the line gameWindow.add(splashScreen.getContent()); but it didn't make a difference.
  6. Replies
    19
    Views
    21

    [SOLVED] Re: JFrame - ImageIcon not displaying

    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=]
  7. Replies
    19
    Views
    21

    [SOLVED] Re: JFrame - ImageIcon not displaying

    Thanks for testing it! Here's my structure:

    Project Folder:

    >src >>default package
    >jre
    >splash_screen.png
  8. Replies
    19
    Views
    21

    [SOLVED] Re: JFrame - ImageIcon not displaying

    Using setBounds and the panel is within bounds of the JFrame. Doesn't help, just a blank JFrame.
  9. Replies
    19
    Views
    21

    [SOLVED] JFrame - ImageIcon not displaying

    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;
Results 1 to 9 of 9