|Help Loading ImageIcons [message #650834]
||Wed, 26 January 2011 18:27
| Jorge Muralles
Registered: January 2011
I am practicing some java and I need some help.|
I amusing eclipse as my development environment.
I created a project called GUI (Graphical User Interface)
I am trying to put an image into an ImageIcon, and then add the icon to a label, then display the label with the image on a main window.
The image I want to display is called face.gif.
I use the following statements:
JFrame frame = new JFrame("Label - Icons - Demo");
ImageIcon icon = new ImageIcon("face.gif");
JLabel label1, label2, lable3;
label1 = new JLabel("Face Left", icon, SwingConstants.CENTER);
//set primary panel
JPanel panel = new JPanel();
//Display main application
Where am I supposed to save the face.gif file and how can I get it to load into the ImageIcon.
Powered by FUDForum
. Page generated in 0.01256 seconds