Results 1 to 4 of 4
Thread: Image icon in SWT
- 07-08-2009, 02:54 PM #1
Member
- Join Date
- Nov 2008
- Posts
- 71
- Rep Power
- 0
Image icon in SWT
please help me.
how to put an image icon in my project...
i tried this:
Image imgicon = new Image(shellSecurity.getDisplay(), "ICON2.jpg");
shellSecurity.setImage(imgicon);
and my error is this
Exception in thread "main" org.eclipse.swt.SWTException: i/o error (java.io.FileNotFoundException: ICON2.jpg (The system cannot find the file specified))
at org.eclipse.swt.SWT.error(SWT.java:3777)
at org.eclipse.swt.SWT.error(SWT.java:3695)
at org.eclipse.swt.graphics.ImageLoader.load(ImageLoa der.java:159)
at org.eclipse.swt.graphics.ImageDataLoader.load(Imag eDataLoader.java:26)
at org.eclipse.swt.graphics.ImageData.<init>(ImageDat a.java:377)
at org.eclipse.swt.graphics.Image.<init>(Image.java:7 35)
at ptime.pos.system.ptime_inteface.<init>(ptime_intef ace.java:43)
at ptime.pos.system.ptime_main.main(ptime_main.java:1 3)
Caused by: java.io.FileNotFoundException: ICON2.jpg (The system cannot find the file specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)
at org.eclipse.swt.internal.Compatibility.newFileInpu tStream(Compatibility.java:182)
at org.eclipse.swt.graphics.ImageLoader.load(ImageLoa der.java:156)
... 5 more
what will i do?:cool:
- 07-09-2009, 06:16 AM #2
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,370
- Blog Entries
- 1
- Rep Power
- 26
Are you sure that the image in the same folder as your application(Java class) included, or may be the image name is wrong. Error message notify that compiler unable to find the image you specified.
- 07-10-2009, 02:44 PM #3
Member
- Join Date
- Nov 2008
- Posts
- 71
- Rep Power
- 0
ok now! tnx :)
:cool:
- 07-11-2009, 03:21 AM #4
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,370
- Blog Entries
- 1
- Rep Power
- 26
Did you solve the problem? If so please mark the thread as solved from the thread tools menu. It's really helpful to all of us.
Similar Threads
-
[SOLVED] JFrame Image Icon
By Ch4os in forum NetBeansReplies: 1Last Post: 11-24-2008, 11:53 AM -
set.Icon
By safiya in forum NetBeansReplies: 2Last Post: 10-17-2008, 07:46 PM -
icon
By amith in forum AWT / SwingReplies: 1Last Post: 05-16-2008, 08:34 PM -
Converting multiple banded image into single banded image... Image enhancement
By archanajathan in forum Advanced JavaReplies: 0Last Post: 01-08-2008, 06:29 PM -
how to remove an image icon
By cecily in forum Advanced JavaReplies: 1Last Post: 08-05-2007, 05:25 AM
Bookmarks