|
Modifier and Type |
Method and Description |
|
addActionListener |
void addActionListener(ActionListener listener)
Adds the specified action listener to receive
ActionEvent s from this TrayIcon .
|
|
addMouseListener |
void addMouseListener(MouseListener listener)
Adds the specified mouse listener to receive mouse events from
this TrayIcon .
-
Adds the specified mouse listener to receive mouse events from
this TrayIcon . Calling this method with a
null value has no effect.
Note: The MouseEvent 's coordinates (received
from the TrayIcon ) are relative to the screen, not the
TrayIcon .
Note: The MOUSE_ENTERED and
MOUSE_EXITED mouse events are not supported.
Refer to AWT Threading Issues for details on AWT's threading model.
- Parameters:
listener - the mouse listener- See Also:
MouseEvent ,
MouseListener ,
removeMouseListener(MouseListener) ,
getMouseListeners()
|
|
addMouseMotionListener |
void addMouseMotionListener(MouseMotionListener listener)
Adds the specified mouse listener to receive mouse-motion
events from this TrayIcon .
|
|
displayMessage |
void displayMessage(java.lang.String caption,
java.lang.String text,
TrayIcon.MessageType messageType)
Displays a popup message near the tray icon.
public void displayMessage(java.lang.String caption,
java.lang.String text,
TrayIcon.MessageType messageType)
-
Displays a popup message near the tray icon. The message will
disappear after a time or if the user clicks on it. Clicking
on the message may trigger an ActionEvent .
Either the caption or the text may be null , but an
NullPointerException is thrown if both are
null .
When displayed, the caption or text strings may be truncated on
some platforms; the number of characters that may be displayed is
platform-dependent.
Note: Some platforms may not support
showing a message.
- Parameters:
caption - the caption displayed above the text, usually in
bold; may be null text - the text displayed for the particular message; may be
null messageType - an enum indicating the message type
- Throws:
java.lang.NullPointerException - if both caption
and text are null
|
|
getActionCommand |
java.lang.String getActionCommand()
Returns the command name of the action event fired by this tray icon.
|
|
getActionListeners |
Returns an array of all the action listeners
registered on this TrayIcon .
|
|
getImage |
Returns the current image used for this TrayIcon .
|
|
getMouseListeners |
Returns an array of all the mouse listeners
registered on this TrayIcon .
|
|
getMouseMotionListeners |
Returns an array of all the mouse-motion listeners
registered on this TrayIcon .
|
|
getPopupMenu |
Returns the popup menu associated with this TrayIcon .
-
Returns the popup menu associated with this TrayIcon .
- Returns:
- the popup menu or
null if none exists - See Also:
setPopupMenu(PopupMenu)
|
|
getSize |
Returns the size, in pixels, of the space that the tray icon
occupies in the system tray.
|
|
getToolTip |
java.lang.String getToolTip()
Returns the tooltip string associated with this
TrayIcon .
public java.lang.String getToolTip()
-
Returns the tooltip string associated with this
TrayIcon .
- Returns:
- the tooltip string or
null if none exists - See Also:
setToolTip(String)
|
|
isImageAutoSize |
boolean isImageAutoSize()
Returns the value of the auto-size property.
public boolean isImageAutoSize()
-
Returns the value of the auto-size property.
- Returns:
true if the image will be auto-sized,
false otherwise- See Also:
setImageAutoSize(boolean)
|
|
removeActionListener |
void removeActionListener(ActionListener listener)
Removes the specified action listener.
|
|
removeMouseListener |
void removeMouseListener(MouseListener listener)
Removes the specified mouse listener.
|
|
removeMouseMotionListener |
void removeMouseMotionListener(MouseMotionListener listener)
Removes the specified mouse-motion listener.
|
|
setActionCommand |
void setActionCommand(java.lang.String command)
Sets the command name for the action event fired by this tray
icon.
public void setActionCommand(java.lang.String command)
-
Sets the command name for the action event fired by this tray
icon. By default, this action command is set to
null .
- Parameters:
command - a string used to set the tray icon's
action command.- See Also:
ActionEvent ,
addActionListener(ActionListener) ,
getActionCommand()
|
|
setImage |
void setImage(Image image)
Sets the image for this TrayIcon .
public void setImage( Image image)
-
Sets the image for this TrayIcon . The previous
tray icon image is discarded without calling the Image.flush() method you will need to call it
manually.
If the image represents an animated image, it will be
animated automatically.
See the setImageAutoSize(boolean) property for
details on the size of the displayed image.
Calling this method with the same image that is currently
being used has no effect.
- Parameters:
image - the non-null Image to be used
- Throws:
java.lang.NullPointerException - if image is null - See Also:
getImage() ,
Image ,
SystemTray.add(TrayIcon) ,
TrayIcon(Image, String)
|
|
setImageAutoSize |
void setImageAutoSize(boolean autosize)
Sets the auto-size property.
public void setImageAutoSize(boolean autosize)
-
Sets the auto-size property. Auto-size determines whether the
tray image is automatically sized to fit the space allocated
for the image on the tray. By default, the auto-size property
is set to false .
If auto-size is false , and the image size
doesn't match the tray icon space, the image is painted as-is
inside that space if larger than the allocated space, it will
be cropped.
If auto-size is true , the image is stretched or shrunk to
fit the tray icon space.
- Parameters:
autosize - true to auto-size the image,
false otherwise- See Also:
isImageAutoSize()
|
|
setPopupMenu |
void setPopupMenu(PopupMenu popup)
Sets the popup menu for this TrayIcon .
-
Sets the popup menu for this TrayIcon . If
popup is null , no popup menu will be
associated with this TrayIcon .
Note that this popup must not be added to any
parent before or after it is set on the tray icon. If you add
it to some parent, the popup may be removed from
that parent.
The popup can be set on one TrayIcon only.
Setting the same popup on multiple TrayIcon s will cause
an IllegalArgumentException .
Note: Some platforms may not support
showing the user-specified popup menu component when the user
right-clicks the tray icon. In this situation, either no menu
will be displayed or, on some systems, a native version of the
menu may be displayed.
- Parameters:
popup - a PopupMenu or null to
remove any popup menu
- Throws:
java.lang.IllegalArgumentException - if the popup is already
set for another TrayIcon - See Also:
getPopupMenu()
|
|
setToolTip |
void setToolTip(java.lang.String tooltip)
Sets the tooltip string for this TrayIcon .
public void setToolTip(java.lang.String tooltip)
-
Sets the tooltip string for this TrayIcon . The
tooltip is displayed automatically when the mouse hovers over
the icon. Setting the tooltip to null removes any
tooltip text.
When displayed, the tooltip string may be truncated on some platforms;
the number of characters that may be displayed is platform-dependent.
- Parameters:
tooltip - the string for the tooltip; if the value is
null no tooltip is shown- See Also:
getToolTip()
|