Results 1 to 4 of 4
  1. #1
    ashin is offline Member
    Join Date
    Nov 2008
    Posts
    71
    Rep Power
    0

    Unhappy 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:

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    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.

  3. #3
    ashin is offline Member
    Join Date
    Nov 2008
    Posts
    71
    Rep Power
    0

    Default

    ok now! tnx :)
    :cool:

  4. #4
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

Similar Threads

  1. [SOLVED] JFrame Image Icon
    By Ch4os in forum NetBeans
    Replies: 1
    Last Post: 11-24-2008, 10:53 AM
  2. set.Icon
    By safiya in forum NetBeans
    Replies: 2
    Last Post: 10-17-2008, 06:46 PM
  3. icon
    By amith in forum AWT / Swing
    Replies: 1
    Last Post: 05-16-2008, 07:34 PM
  4. Replies: 0
    Last Post: 01-08-2008, 05:29 PM
  5. how to remove an image icon
    By cecily in forum Advanced Java
    Replies: 1
    Last Post: 08-05-2007, 04:25 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •