Hi, I'm using the Java SystemTray http://java.sun.com/javase/6/docs/api/java/awt/SystemTray.html to display a parameter.
I want to read this parameter hourly and display the value in the system tray.
My problem is that I can only display a trayicon and not a string.
I know I can add a popup to the tray icon which contains a string but i wanted the user to see teh string without any interaction.
One last quick one, I am currently only able to display 2 characters in the icon using this method.
Is there anyway to squeeze more chars in here, or am I limited to just two?
I guess the 16x16 pixel size of the icon limits the space...
Thanks,
Jon
I can think of two ways to shrink your letters:
1) make a larger image, and call setImageAutoSize(true) on your TrayIcon
2) use a smaller font for the Graphics object.
You can do 2 like this:
Overall 1) should be easier since the size doesn't really matter. You can make the image any size (as long as it is a square), and let the system handle the resize. However, I don't know if it performs well. You will have to test that.
One last question about Images. I have 2 gifs, both are 8 pixels wide and 16 pixels high.
I want to put one gif on the left side of a system tray icon and the other on the right side.
Sort of like below, is this possible to do? I've been try to get it to work without success for the last while.
ImageIcon calls a protected method called loadImage after it has loaded the image using Toolkit.getDefaultToolkit().getImage:
tracker is an instance of MediaTracker, getNextID() simply returns a new ID each time it's called.