351 /**
352 * Returns the size, in pixels, of the space that a tray icon will
353 * occupy in the system tray. Developers may use this methods to
354 * acquire the preferred size for the image property of a tray icon
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 border=1 summary="SystemTray properties">
372 * <tr>
373 * <th>Property</th>
374 * <th>Description</th>
375 * </tr>
376 * <tr>
377 * <td>{@code trayIcons}</td>
378 * <td>The {@code SystemTray}'s array of {@code TrayIcon} objects.
379 * The array is accessed via the {@link #getTrayIcons} method.<br>
380 * This property is changed when a tray icon is added to (or removed
381 * from) the system tray.<br> For example, this property is changed
382 * when the system tray becomes unavailable on the desktop<br>
383 * and the tray icons are automatically removed.</td>
384 * </tr>
385 * <tr>
386 * <td>{@code systemTray}</td>
387 * <td>This property contains {@code SystemTray} instance when the system tray
388 * is available or {@code null} otherwise.<br> This property is changed
389 * when the system tray becomes available or unavailable on the desktop.<br>
390 * The property is accessed by the {@link #getSystemTray} method.</td>
391 * </tr>
392 * </table>
393 * <p>
394 * The {@code listener} listens to property changes only in this context.
395 * <p>
396 * If {@code listener} is {@code null}, no exception is thrown
397 * and no action is performed.
398 *
399 * @param propertyName the specified property
400 * @param listener the property change listener to be added
401 *
402 * @see #removePropertyChangeListener
403 * @see #getPropertyChangeListeners
404 */
405 public synchronized void addPropertyChangeListener(String propertyName,
406 PropertyChangeListener listener)
407 {
408 if (listener == null) {
409 return;
410 }
411 getCurrentChangeSupport().addPropertyChangeListener(propertyName, listener);
|
351 /**
352 * Returns the size, in pixels, of the space that a tray icon will
353 * occupy in the system tray. Developers may use this methods to
354 * acquire the preferred size for the image property of a tray icon
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 }
416 getCurrentChangeSupport().addPropertyChangeListener(propertyName, listener);
|