Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Help Loading ImageIcons(ImageIcon and images directory)
Help Loading ImageIcons [message #650834] Wed, 26 January 2011 18:27
Jorge Muralles is currently offline Jorge MurallesFriend
Messages: 1
Registered: January 2011
Junior Member
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();


panel.setPreferredSize(new Dimension(200,250));


//Display main application




Where am I supposed to save the face.gif file and how can I get it to load into the ImageIcon.

Thank you.
Previous Topic:Where in JDT is task tag support implemented?
Next Topic:Debug breakpoint ok on backend but not on GUI client
Goto Forum:

Current Time: Fri Apr 20 05:08:30 GMT 2018

Powered by FUDForum. Page generated in 0.01528 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software