Skip to main content



      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] Mon, 14 May 2012 20:13 Go to next message
Eclipse UserFriend
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 18:36 Go to previous messageGo to next message
Eclipse UserFriend
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 01:20 Go to previous message
Eclipse UserFriend
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: Tue Jul 08 14:05:03 EDT 2025

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

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

Back to the top