public class TrayIcon extends Component {
public static final int MB_LEFT = MouseButton.LEFT;
public static final int MB_RIGHT = MouseButton.RIGHT;
public static final int MB_MIDDLE = MouseButton.MIDDLE;
private static final Object EVENT_MOUSEDOWN = new Object();
private static final Object EVENT_MOUSEENTER = new Object();
private static final Object EVENT_MOUSELEAVE = new Object();
private static final Object EVENT_MOUSEMOVE = new Object();
private static final Object EVENT_MOUSEUP = new Object();
private static final Object EVENT_CLICK = new Object();
private static final Object EVENT_DOUBLECLICK = new Object();
/*
* This API creates a unique message ID, and associates it with a string
* that you specify. It allows multiple applications to get the same
* ID for the same message, and to ensure that the ID doesn't collide with
* other Win32 message IDs already defined. That's what we use it for here.
*/
private static final int WM_TRAYMOUSEMESSAGE = RegisterWindowMessage( "TrayIconNotification" ); // win.WM_USER + 1024;
/** @dll.import( "user32", auto ) */
private native static int RegisterWindowMessage( String messageName );
TrayIconWindow(TrayIcon control) {
ref = new com.ms.vm.WeakReference(control);
}
protected void wndProc(Message m) {
TrayIcon control = (TrayIcon)ref.getReferent();
control.wndProc(m);
super.wndProc(m);
}
}
public static class ClassInfo extends Component.ClassInfo {
public static final PropertyInfo Text =
new PropertyInfo(TrayIcon.class, "text", String.class,
CategoryAttribute.Appearance,
LocalizableAttribute.YES,
new DescriptionAttribute("The text that will be displayed when the mouse hovers over the icon."));
public static final PropertyInfo Icon =
new PropertyInfo(TrayIcon.class, "icon", Icon.class,
CategoryAttribute.Appearance,
LocalizableAttribute.YES,
new DescriptionAttribute("The icon to display in the system tray."));
public static final PropertyInfo Visible =
new PropertyInfo(TrayIcon.class, "visible", Boolean.TYPE,
CategoryAttribute.Behavior,
new DefaultValueAttribute(Boolean.FALSE),
new DescriptionAttribute("Determines whether the control is visible or hidden"));
public static final PropertyInfo Enabled =
new PropertyInfo( TrayIcon.class, "enabled", Boolean.TYPE,
CategoryAttribute.Behavior,
new DefaultValueAttribute( null ),
new DescriptionAttribute( "Determines whether the control is enabled or disabled" )
);
public static final EventInfo OnMouseDown =
new EventInfo(TrayIcon.class, "mouseDown", MouseEventHandler.class,
CategoryAttribute.Mouse,
new DescriptionAttribute("Occurs when a mouse button is pressed"));
public static final EventInfo OnMouseMove =
new EventInfo(TrayIcon.class, "mouseMove", MouseEventHandler.class,
CategoryAttribute.Mouse,
new DescriptionAttribute("Occurs when the mouse is moved"));
public static final EventInfo OnMouseUp =
new EventInfo(TrayIcon.class, "mouseUp", MouseEventHandler.class,
CategoryAttribute.Mouse,
new DescriptionAttribute("Occurs when a mouse button is released"));