< prev index next >

src/java.desktop/share/classes/java/awt/SystemTray.java

Print this page




 355      * before it is created.  For convenience, there is a similar
 356      * method {@link TrayIcon#getSize} in the {@code TrayIcon} class.
 357      *
 358      * @return the default size of a tray icon, in pixels
 359      * @see TrayIcon#setImageAutoSize(boolean)
 360      * @see java.awt.Image
 361      * @see TrayIcon#getSize()
 362      */
 363     public Dimension getTrayIconSize() {
 364         return peer.getTrayIconSize();
 365     }
 366 
 367     /**
 368      * Adds a {@code PropertyChangeListener} to the list of listeners for the
 369      * specific property. The following properties are currently supported:
 370      *
 371      * <table class="striped">
 372      * <caption>SystemTray properties</caption>
 373      * <thead>
 374      * <tr>
 375      *    <th>Property</th>
 376      *    <th>Description</th>
 377      * </tr>
 378      * </thead>
 379      * <tbody>
 380      * <tr>
 381      *    <td>{@code trayIcons}</td>
 382      *    <td>The {@code SystemTray}'s array of {@code TrayIcon} objects.
 383      *        The array is accessed via the {@link #getTrayIcons} method.<br>
 384      *        This property is changed when a tray icon is added to (or removed
 385      *        from) the system tray.<br> For example, this property is changed
 386      *        when the system tray becomes unavailable on the desktop<br>
 387      *        and the tray icons are automatically removed.</td>
 388      * </tr>
 389      * <tr>
 390      *    <td>{@code systemTray}</td>
 391      *    <td>This property contains {@code SystemTray} instance when the system tray
 392      *        is available or {@code null} otherwise.<br> This property is changed
 393      *        when the system tray becomes available or unavailable on the desktop.<br>
 394      *        The property is accessed by the {@link #getSystemTray} method.</td>
 395      * </tr>
 396      * </tbody>
 397      * </table>
 398      * <p>
 399      * The {@code listener} listens to property changes only in this context.
 400      * <p>
 401      * If {@code listener} is {@code null}, no exception is thrown
 402      * and no action is performed.
 403      *
 404      * @param propertyName the specified property
 405      * @param listener the property change listener to be added
 406      *
 407      * @see #removePropertyChangeListener
 408      * @see #getPropertyChangeListeners
 409      */
 410     public synchronized void addPropertyChangeListener(String propertyName,
 411                                                        PropertyChangeListener listener)
 412     {
 413         if (listener == null) {
 414             return;
 415         }




 355      * before it is created.  For convenience, there is a similar
 356      * method {@link TrayIcon#getSize} in the {@code TrayIcon} class.
 357      *
 358      * @return the default size of a tray icon, in pixels
 359      * @see TrayIcon#setImageAutoSize(boolean)
 360      * @see java.awt.Image
 361      * @see TrayIcon#getSize()
 362      */
 363     public Dimension getTrayIconSize() {
 364         return peer.getTrayIconSize();
 365     }
 366 
 367     /**
 368      * Adds a {@code PropertyChangeListener} to the list of listeners for the
 369      * specific property. The following properties are currently supported:
 370      *
 371      * <table class="striped">
 372      * <caption>SystemTray properties</caption>
 373      * <thead>
 374      *   <tr>
 375      *     <th scope="col">Property
 376      *     <th scope="col">Description

 377      * </thead>
 378      * <tbody>
 379      *   <tr>
 380      *     <th scope="row">{@code trayIcons}
 381      *     <td>The {@code SystemTray}'s array of {@code TrayIcon} objects. The
 382      *     array is accessed via the {@link #getTrayIcons} method. This property
 383      *     is changed when a tray icon is added to (or removed from) the system
 384      *     tray. For example, this property is changed when the system tray
 385      *     becomes unavailable on the desktop and the tray icons are
 386      *     automatically removed.

 387      *   <tr>
 388      *     <th scope="row">{@code systemTray}
 389      *     <td>This property contains {@code SystemTray} instance when the
 390      *     system tray is available or {@code null} otherwise. This property is
 391      *     changed when the system tray becomes available or unavailable on the
 392      *     desktop. The property is accessed by the {@link #getSystemTray}
 393      *     method.
 394      * </tbody>
 395      * </table>
 396      * <p>
 397      * The {@code listener} listens to property changes only in this context.
 398      * <p>
 399      * If {@code listener} is {@code null}, no exception is thrown
 400      * and no action is performed.
 401      *
 402      * @param propertyName the specified property
 403      * @param listener the property change listener to be added
 404      *
 405      * @see #removePropertyChangeListener
 406      * @see #getPropertyChangeListeners
 407      */
 408     public synchronized void addPropertyChangeListener(String propertyName,
 409                                                        PropertyChangeListener listener)
 410     {
 411         if (listener == null) {
 412             return;
 413         }


< prev index next >