Java SystemTray icon -
there a simple tutorial on implementing system tray icon.
the problem is, can see icon in tray if run app eclipse, can't see if export , run runnable jar file. have other images in app work fine form same folder.
the tray working (left , right click on it) doesn't show image, can see in image (the jar file on top, eclipse on bottom):
why? thank , sorry english!
edit: found solution image need accessed whit:
image img = toolkit.getdefaulttoolkit().getimage(myclass.class.getresource("/images/asd.png"));
the problem way include image file. will have include image in jar when create it, , have access image in different manner:
try { inputstream = classloader.getsystemclassloader().getresourceasstream("wing16.png"); bufferedimage img = imageio.read(is); } catch (ioexception e) {}
you can used img
variable set image in jar.
update:
take of class files & images , go command line:
jar -cvfm test.jar manifest.mft *.class image.png
replace manifest.mft
manifest file name. replace image.png
image want show (you can include more images if need to)
Comments
Post a Comment