• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

TrayIconDemo on VISTA

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using the example in sun site http://java.sun.com/docs/books/tutorial/uiswing/misc/systemtray.html and it throw exception so i try this line



to replace this line



and it didn't throw exception but i can't see my image in the system tray but i steel can right click on it and see the menu

using java 6 update 12 on windows vista 32 bit ultimate sp1

thank you for your time
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What's this createImage method?
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
running the demo code as-is worked OK for me
i.e. no problems at all with
final TrayIcon trayIcon = new TrayIcon(createImage("images/bulb.gif","tray icon"));

probably nothing to do with why the toolkit didn't work, but your image names are diferent

"images/bulb.gif"
"images/java.gif"
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Ray Man", please check your private messages for an important administrative matter.
 
Ramy Raslan
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

first thanks all for your time, contributions and help

for your questions

createImage is a method is a method in the example look at the class bottom

for the image name I put both of them in the same directory images and double checked it
they both are their

thanks again and any help is very much appreciated
 
Rob Spoor
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is there any output on the console?
 
Ramy Raslan
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes the code run with no problems it's just no icon on vista
i will try some other ways and but my feed back asap

thanks every one for helping me
 
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
it worked with me and i am running windows 7..could you tell us what your error message was?
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It works fine for all of us.
Any specific IDE that you use?

Only thing we can think of, is wrong path for the "images" folder.. OR wrong image name.
 
Shrinath M Aithal
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hall Nation wrote:It works fine for all of us.
Any specific IDE that you use?

Only thing we can think of, is wrong path for the "images" folder.. OR wrong image name.



agreed.. and if he is getting that main not found error, then he is missing the point of packages there..

@Ramy : why dont you post your exact error that came before you altered the code? and did you observe the "package misc " statement in the source file?
 
Hall Nation
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tried the program again with the two new lines below :



instead of


Curiously, I also faced the same problem as the OP faced. It wouldn't take the bulb image in the specific path (eventhough it was present), but the menu et all did work. The original program worked like a charm though. Still trying to figure out why the other approach didn't work.
 
Rob Spoor
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Toolkit.getImage uses a file name, whereas the createImage uses a resource name. The former is relative to the current directory. The second is relative to the class file. Except when you are executing your Java program from the same folder as the class file, these two are different.
 
reply
    Bookmark Topic Watch Topic
  • New Topic