|
JDIC API V2006 Release 0308 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jdesktop.jdic.tray.TrayIcon
public class TrayIcon
The TrayIcon
class represents a tray Icon that can be added to
a System tray. A TrayIcon can have a caption (text), an Icon and a menu
associated with it. In addition a TrayIcon can also have a tooltip
associated that is displayed when the mouse hovers over the TrayIcon.
TrayIcons will display the specified Menu when a right mouse click is performed on the TrayIcon. Left button clicking will trigger ActionEvents.
Field Summary | |
---|---|
static int |
ERROR_MESSAGE_TYPE
Used for error messages. |
static int |
INFO_MESSAGE_TYPE
Used for information messages. |
static int |
NONE_MESSAGE_TYPE
No icon is used. |
static int |
WARNING_MESSAGE_TYPE
Used for warning messages. |
Constructor Summary | |
---|---|
TrayIcon(javax.swing.Icon i)
TrayIcon constructor - creates a TrayIcon with the specified Icon |
|
TrayIcon(javax.swing.Icon icon,
java.lang.String caption)
TrayIcon constructor - creates a TrayIcon with the specified Icon and the specified caption. |
|
TrayIcon(javax.swing.Icon icon,
java.lang.String caption,
javax.swing.JPopupMenu popup)
TrayIcon constructor - creates a TrayIcon with the specified Icon the specified caption and Popup menu. |
Method Summary | |
---|---|
void |
addActionListener(java.awt.event.ActionListener listener)
Adds the specified ActionListener to the list of ActionListeners for this component. |
void |
addBalloonActionListener(java.awt.event.ActionListener listener)
Adds the specified ActionListener to the list of ActionListeners for this trayicon's balloon message. |
void |
displayMessage(java.lang.String caption,
java.lang.String text,
int type)
Displays a popup message near the tray icon. |
java.awt.Point |
getLocationOnScreen()
Gets the location on screen for this TrayIcon |
void |
removeActionListener(java.awt.event.ActionListener listener)
Removes the specified ActionListener from the list of ActionListeners for this component. |
void |
removeBalloonActionListener(java.awt.event.ActionListener listener)
Removes the specified ActionListener from the list of ActionListeners for this trayicon's balloon message. |
void |
setCaption(java.lang.String caption)
Sets the caption for this TrayIcon. |
void |
setIcon(javax.swing.Icon icon)
Sets the icon for this TrayIcon. |
void |
setIconAutoSize(boolean autosize)
Sets the auto-size property. |
void |
setPopupMenu(javax.swing.JPopupMenu popup)
Sets the PopupMenu for this TrayIcon. |
void |
setToolTip(java.lang.String tooltip)
Sets the ToolTip string for this TrayIcon. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int INFO_MESSAGE_TYPE
public static final int ERROR_MESSAGE_TYPE
public static final int WARNING_MESSAGE_TYPE
public static final int NONE_MESSAGE_TYPE
Constructor Detail |
---|
public TrayIcon(javax.swing.Icon i)
public TrayIcon(javax.swing.Icon icon, java.lang.String caption)
icon
- Iconcaption
- caption to usepublic TrayIcon(javax.swing.Icon icon, java.lang.String caption, javax.swing.JPopupMenu popup)
icon
- Iconcaption
- caption to usepopup
- popupMenu to useMethod Detail |
---|
public void setIcon(javax.swing.Icon icon)
icon
- icon to usepublic void setPopupMenu(javax.swing.JPopupMenu popup)
popup
- Popuppublic void setToolTip(java.lang.String tooltip)
tooltip
- public void addActionListener(java.awt.event.ActionListener listener)
listener
- public void removeActionListener(java.awt.event.ActionListener listener)
listener
- public void setCaption(java.lang.String caption)
caption
- public void setIconAutoSize(boolean autosize)
public java.awt.Point getLocationOnScreen()
public void displayMessage(java.lang.String caption, java.lang.String text, int type) throws java.lang.NullPointerException
Either the caption or the text may be null, but an NullPointerException is thrown if both are null.
Note: Some platforms may not support showing a message.
caption
- the caption displayed above the text, usually in bold; may be nulltext
- the text displayed for the particular message; may be nulltype
- the type of message to be displayed:
INFO_MESSAGE_TYPE
, ERROR_MESSAGE_TYPE
,
WARNING_MESSAGE_TYPE
, NONE_MESSAGE_TYPE
java.lang.NullPointerException
- If both caption and text are nullpublic void addBalloonActionListener(java.awt.event.ActionListener listener)
listener
- public void removeBalloonActionListener(java.awt.event.ActionListener listener)
listener
-
|
JDIC API V2006 Release 0308 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, working code examples, license terms and bug report information.
Copyright (c) 2004 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.