Hi. I am trying to display a JFrame containing a JLabel with an image, and I can't get the image to display. The text appears fine.
I've done this before with no problem, so I have no idea what is wrong. I've tried everything I can think of to fix it.
import java.awt.Dimension;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
public class Main
{
public static void main( String[] args )
{
JFrame frame = new JFrame( "VN" );
JLabel image = new JLabel( "hello", new ImageIcon( "vn1.bmp" ), JLabel.LEFT );
image.setPreferredSize( new Dimension( 720, 460 ) );
frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
frame.getContentPane().add( image );
frame.pack();
frame.setVisible( true );
}
}
Thank you.