Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Need help with images(Can get an image to display as working in the ide but when the project is run it does not work)
Need help with images [message #871827] Tue, 15 May 2012 00:13 Go to next message
George Smith is currently offline George SmithFriend
Messages: 4
Registered: March 2012
Junior Member
Hi, I am having trouble getting images working. I have installed a designer plugin that shows what the program should look like when it is run and it shows the picture as being there and working, however when I run it, it doesn't display. Below is the code I have been using to display the pic that works in the ide, would appreciate any help

	
private JPanel getjPanelImages() {
if (jPanelImages == null) {
			String path = "3.png";
			jPanelImages = new JPanel(new BorderLayout());
			JLabel label = new JLabel(new ImageIcon(path));
			label.setHorizontalAlignment(JLabel.CENTER);jPanelImages.add(label);
			//jPanel1 = new JPanel();
			//jPanel1.setLayout(new GroupLayout());
			//jPanel1.add(getJLabel0(), new Constraints(new Leading(140, 10, 10), new Leading(137, 10, 10)));
		}
		return jPanelImages;
	}
Re: Need help with images [message #872321 is a reply to message #871827] Tue, 15 May 2012 22:36 Go to previous messageGo to next message
David Wegener is currently offline David WegenerFriend
Messages: 1445
Registered: July 2009
Senior Member
3.png has to be in the working directory where you run the application. You can set the working directory on the Launch Configuration page for your application
Re: Need help with images [message #872425 is a reply to message #871827] Wed, 16 May 2012 05:20 Go to previous message
George Smith is currently offline George SmithFriend
Messages: 4
Registered: March 2012
Junior Member
Yes, thank you that was exactly it. I had the image in the eclipse folder which is where it needed to be for the designer plugin to show it whereas for it to show when I ran the application it needed to be as you said in the program folder.

Much appreciated

Smile
Previous Topic:problem with javacard at eclipse
Next Topic:Eclipse freezing when loading
Goto Forum:
  


Current Time: Wed Apr 24 15:52:36 GMT 2024

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

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

Back to the top