< prev index next >

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

Print this page




  74          * Represents a graphical icon badge feature for a window.
  75          * @see #setWindowIconBadge(java.awt.Window, java.awt.Image)
  76          */
  77         ICON_BADGE_IMAGE_WINDOW,
  78 
  79         /**
  80          * Represents an icon feature.
  81          * @see #setIconImage(java.awt.Image)
  82          */
  83         ICON_IMAGE,
  84 
  85         /**
  86          * Represents a menu feature.
  87          * @see #setMenu(java.awt.PopupMenu)
  88          * @see #getMenu()
  89          */
  90         MENU,
  91 
  92         /**
  93          * Represents a progress state feature for a specified window.
  94          * @see #setWindowProgressState(java.awt.Window, State)
  95          */
  96         PROGRESS_STATE_WINDOW,
  97 
  98         /**
  99          * Represents a progress value feature.
 100          * @see #setProgressValue(int)
 101          */
 102         PROGRESS_VALUE,
 103 
 104         /**
 105          * Represents a progress value feature for a specified window.
 106          * @see #setWindowProgressValue(java.awt.Window, int)
 107          */
 108         PROGRESS_VALUE_WINDOW,
 109 
 110         /**
 111          * Represents a user attention request feature.
 112          * @see #requestUserAttention(boolean, boolean)
 113          */
 114         USER_ATTENTION,
 115 
 116         /**
 117          * Represents a user attention request feature for a specified window.
 118          * @see #requestWindowUserAttention(java.awt.Window)
 119          */
 120         USER_ATTENTION_WINDOW
 121     }
 122 
 123     /**
 124      * Kinds of available window progress states.
 125      *
 126      * @see #setWindowProgressState(java.awt.Window, java.awt.Taskbar.State)
 127      */
 128     public static enum State {
 129         /**
 130          * Stops displaying the progress.
 131          */
 132         OFF,
 133         /**
 134          * The progress indicator displays with normal color and determinate
 135          * mode.
 136          */
 137         NORMAL,
 138         /**
 139          * Shows progress as paused, progress can be resumed by the user.
 140          * Switches to the determinate display.
 141          */
 142         PAUSED,
 143         /**
 144          * The progress indicator displays activity without specifying what
 145          * proportion of the progress is complete.
 146          */


 257      * Other platforms may require an additional call
 258      * {@link #requestUserAttention} to dismiss this request
 259      * with {@code enabled} parameter set to false.
 260      *
 261      * @param enabled disables this request if false
 262      * @param critical if this is an important request
 263      * @throws SecurityException if a security manager exists and it denies the
 264      * {@code RuntimePermission("canProcessApplicationEvents")} permission.
 265      * @throws UnsupportedOperationException if the current platform
 266      * does not support the {@link Taskbar.Feature#USER_ATTENTION} feature
 267      */
 268     public void requestUserAttention(final boolean enabled, final boolean critical) {
 269         checkEventsProcessingPermission();
 270         checkFeatureSupport(Feature.USER_ATTENTION);
 271         peer.requestUserAttention(enabled, critical);
 272     }
 273 
 274     /**
 275      * Requests user attention to the specified window.
 276      *
 277      * @param w window


 278      * @throws SecurityException if a security manager exists and it denies the
 279      * {@code RuntimePermission("canProcessApplicationEvents")} permission.
 280      * @throws UnsupportedOperationException if the current platform
 281      * does not support the {@link Taskbar.Feature#USER_ATTENTION_WINDOW} feature
 282      */
 283     public void requestWindowUserAttention(Window w) {
 284         checkEventsProcessingPermission();
 285         checkFeatureSupport(Feature.USER_ATTENTION_WINDOW);
 286         peer.requestWindowUserAttention(w);
 287     }
 288 
 289     /**
 290      * Attaches the contents of the provided PopupMenu to the application icon
 291      * in the task area.
 292      *
 293      * @param menu the PopupMenu to attach to this application
 294      * @throws SecurityException if a security manager exists and it denies the
 295      * {@code RuntimePermission("canProcessApplicationEvents")} permission.
 296      * @throws UnsupportedOperationException if the current platform
 297      * does not support the {@link Taskbar.Feature#MENU} feature
 298      */
 299     public void setMenu(final PopupMenu menu) {
 300         checkEventsProcessingPermission();
 301         checkFeatureSupport(Feature.MENU);
 302         peer.setMenu(menu);
 303     }
 304 
 305     /**
 306      * Gets PopupMenu used to add items to this application's icon in system task area.


 358      *
 359      * Passing {@code null} as parameter hides the badge.
 360      * @param badge label to affix to the icon
 361      * @throws SecurityException if a security manager exists and it denies the
 362      * {@code RuntimePermission("canProcessApplicationEvents")} permission.
 363      * @throws UnsupportedOperationException if the current platform
 364      * does not support the {@link Taskbar.Feature#ICON_BADGE_NUMBER}
 365      * or {@link Taskbar.Feature#ICON_BADGE_TEXT} feature
 366      */
 367     public void setIconBadge(final String badge) {
 368         checkEventsProcessingPermission();
 369         checkFeatureSupport(Feature.ICON_BADGE_NUMBER);
 370         peer.setIconBadge(badge);
 371     }
 372 
 373     /**
 374      * Affixes a small badge to this application's icon in the task area
 375      * for the specified window.
 376      * It may be disabled by system settings.
 377      *
 378      * @param w window to update


 379      * @param badge image to affix to the icon
 380      * @throws SecurityException if a security manager exists and it denies the
 381      * {@code RuntimePermission("canProcessApplicationEvents")} permission.
 382      * @throws UnsupportedOperationException if the current platform
 383      * does not support the {@link Taskbar.Feature#ICON_BADGE_IMAGE_WINDOW} feature
 384      */
 385     public void setWindowIconBadge(Window w, final Image badge) {
 386         checkEventsProcessingPermission();
 387         checkFeatureSupport(Feature.ICON_BADGE_IMAGE_WINDOW);
 388         if (w != null) {
 389             peer.setWindowIconBadge(w, badge);
 390         }
 391     }
 392 
 393 
 394     /**
 395      * Affixes a small system-provided progress bar to this application's icon.
 396      *
 397      * @param value from 0 to 100, other to disable progress indication
 398      * @throws SecurityException if a security manager exists and it denies the
 399      * {@code RuntimePermission("canProcessApplicationEvents")} permission.
 400      * @throws UnsupportedOperationException if the current platform
 401      * does not support the {@link Taskbar.Feature#PROGRESS_VALUE} feature
 402      */
 403     public void setProgressValue(int value) {
 404         checkEventsProcessingPermission();
 405         checkFeatureSupport(Feature.PROGRESS_VALUE);
 406         peer.setProgressValue(value);
 407     }
 408 
 409     /**
 410      * Displays a determinate progress bar in the task area for the specified
 411      * window.


 412      * <br>
 413      * The visual behavior is platform and {@link State} dependent.
 414      * <br>
 415      * This call cancels the {@link State#INDETERMINATE INDETERMINATE} state
 416      * of the window.
 417      * <br>
 418      * Note that when multiple windows is grouped in the task area
 419      * the behavior is platform specific.
 420      *
 421      * @param w window to update
 422      * @param value from 0 to 100, other to switch to {@link State#OFF} state
 423      *              and disable progress indication
 424      * @see #setWindowProgressState(java.awt.Window, State)
 425      * @throws SecurityException if a security manager exists and it denies the
 426      * {@code RuntimePermission("canProcessApplicationEvents")} permission.
 427      * @throws UnsupportedOperationException if the current platform
 428      * does not support the {@link Taskbar.Feature#PROGRESS_VALUE_WINDOW} feature
 429      */
 430     public void setWindowProgressValue(Window w, int value) {
 431         checkEventsProcessingPermission();
 432         checkFeatureSupport(Feature.PROGRESS_VALUE_WINDOW);
 433         if (w != null) {
 434             peer.setWindowProgressValue(w, value);
 435         }
 436     }
 437 
 438     /**
 439      * Sets a progress state for a specified window.


 440      * <br>
 441      * Each state displays a progress in a platform-dependent way.
 442      * <br>
 443      * Note than switching from {@link State#INDETERMINATE INDETERMINATE} state
 444      * to any of determinate states may reset value set by
 445      * {@link #setWindowProgressValue(java.awt.Window, int) setWindowProgressValue}
 446      *
 447      * @param w window
 448      * @param state to change to
 449      * @see State#OFF
 450      * @see State#NORMAL
 451      * @see State#PAUSED
 452      * @see State#ERROR
 453      * @see State#INDETERMINATE
 454      * @see #setWindowProgressValue(java.awt.Window, int)
 455      * @throws SecurityException if a security manager exists and it denies the
 456      * {@code RuntimePermission("canProcessApplicationEvents")} permission.
 457      * @throws UnsupportedOperationException if the current platform
 458      * does not support the {@link Taskbar.Feature#PROGRESS_STATE_WINDOW} feature
 459      */
 460     public void setWindowProgressState(Window w, State state) {
 461         checkEventsProcessingPermission();
 462         checkFeatureSupport(Feature.PROGRESS_STATE_WINDOW);
 463         if (w != null) {
 464             peer.setWindowProgressState(w, state);
 465         }
 466     }
 467 }


  74          * Represents a graphical icon badge feature for a window.
  75          * @see #setWindowIconBadge(java.awt.Window, java.awt.Image)
  76          */
  77         ICON_BADGE_IMAGE_WINDOW,
  78 
  79         /**
  80          * Represents an icon feature.
  81          * @see #setIconImage(java.awt.Image)
  82          */
  83         ICON_IMAGE,
  84 
  85         /**
  86          * Represents a menu feature.
  87          * @see #setMenu(java.awt.PopupMenu)
  88          * @see #getMenu()
  89          */
  90         MENU,
  91 
  92         /**
  93          * Represents a progress state feature for a specified window.
  94          * @see #setWindowProgressState(java.awt.Frame, State)
  95          */
  96         PROGRESS_STATE_WINDOW,
  97 
  98         /**
  99          * Represents a progress value feature.
 100          * @see #setProgressValue(int)
 101          */
 102         PROGRESS_VALUE,
 103 
 104         /**
 105          * Represents a progress value feature for a specified window.
 106          * @see #setWindowProgressValue(java.awt.Frame, int)
 107          */
 108         PROGRESS_VALUE_WINDOW,
 109 
 110         /**
 111          * Represents a user attention request feature.
 112          * @see #requestUserAttention(boolean, boolean)
 113          */
 114         USER_ATTENTION,
 115 
 116         /**
 117          * Represents a user attention request feature for a specified window.
 118          * @see #requestWindowUserAttention(java.awt.Frame)
 119          */
 120         USER_ATTENTION_WINDOW
 121     }
 122 
 123     /**
 124      * Kinds of available window progress states.
 125      *
 126      * @see #setWindowProgressState(java.awt.Frame, java.awt.Taskbar.State)
 127      */
 128     public static enum State {
 129         /**
 130          * Stops displaying the progress.
 131          */
 132         OFF,
 133         /**
 134          * The progress indicator displays with normal color and determinate
 135          * mode.
 136          */
 137         NORMAL,
 138         /**
 139          * Shows progress as paused, progress can be resumed by the user.
 140          * Switches to the determinate display.
 141          */
 142         PAUSED,
 143         /**
 144          * The progress indicator displays activity without specifying what
 145          * proportion of the progress is complete.
 146          */


 257      * Other platforms may require an additional call
 258      * {@link #requestUserAttention} to dismiss this request
 259      * with {@code enabled} parameter set to false.
 260      *
 261      * @param enabled disables this request if false
 262      * @param critical if this is an important request
 263      * @throws SecurityException if a security manager exists and it denies the
 264      * {@code RuntimePermission("canProcessApplicationEvents")} permission.
 265      * @throws UnsupportedOperationException if the current platform
 266      * does not support the {@link Taskbar.Feature#USER_ATTENTION} feature
 267      */
 268     public void requestUserAttention(final boolean enabled, final boolean critical) {
 269         checkEventsProcessingPermission();
 270         checkFeatureSupport(Feature.USER_ATTENTION);
 271         peer.requestUserAttention(enabled, critical);
 272     }
 273 
 274     /**
 275      * Requests user attention to the specified window.
 276      *
 277      * Has no effect if this window is not visible in the task area.
 278      *
 279      * @param f Frame
 280      * @throws SecurityException if a security manager exists and it denies the
 281      * {@code RuntimePermission("canProcessApplicationEvents")} permission.
 282      * @throws UnsupportedOperationException if the current platform
 283      * does not support the {@link Taskbar.Feature#USER_ATTENTION_WINDOW} feature
 284      */
 285     public void requestWindowUserAttention(Frame f) {
 286         checkEventsProcessingPermission();
 287         checkFeatureSupport(Feature.USER_ATTENTION_WINDOW);
 288         peer.requestWindowUserAttention(f);
 289     }
 290 
 291     /**
 292      * Attaches the contents of the provided PopupMenu to the application icon
 293      * in the task area.
 294      *
 295      * @param menu the PopupMenu to attach to this application
 296      * @throws SecurityException if a security manager exists and it denies the
 297      * {@code RuntimePermission("canProcessApplicationEvents")} permission.
 298      * @throws UnsupportedOperationException if the current platform
 299      * does not support the {@link Taskbar.Feature#MENU} feature
 300      */
 301     public void setMenu(final PopupMenu menu) {
 302         checkEventsProcessingPermission();
 303         checkFeatureSupport(Feature.MENU);
 304         peer.setMenu(menu);
 305     }
 306 
 307     /**
 308      * Gets PopupMenu used to add items to this application's icon in system task area.


 360      *
 361      * Passing {@code null} as parameter hides the badge.
 362      * @param badge label to affix to the icon
 363      * @throws SecurityException if a security manager exists and it denies the
 364      * {@code RuntimePermission("canProcessApplicationEvents")} permission.
 365      * @throws UnsupportedOperationException if the current platform
 366      * does not support the {@link Taskbar.Feature#ICON_BADGE_NUMBER}
 367      * or {@link Taskbar.Feature#ICON_BADGE_TEXT} feature
 368      */
 369     public void setIconBadge(final String badge) {
 370         checkEventsProcessingPermission();
 371         checkFeatureSupport(Feature.ICON_BADGE_NUMBER);
 372         peer.setIconBadge(badge);
 373     }
 374 
 375     /**
 376      * Affixes a small badge to this application's icon in the task area
 377      * for the specified window.
 378      * It may be disabled by system settings.
 379      *
 380      * Has no effect if this window is not visible in the task area.
 381      *
 382      * @param f frame to update
 383      * @param badge image to affix to the icon
 384      * @throws SecurityException if a security manager exists and it denies the
 385      * {@code RuntimePermission("canProcessApplicationEvents")} permission.
 386      * @throws UnsupportedOperationException if the current platform
 387      * does not support the {@link Taskbar.Feature#ICON_BADGE_IMAGE_WINDOW} feature
 388      */
 389     public void setWindowIconBadge(Frame f, final Image badge) {
 390         checkEventsProcessingPermission();
 391         checkFeatureSupport(Feature.ICON_BADGE_IMAGE_WINDOW);
 392         if (f != null) {
 393             peer.setWindowIconBadge(f, badge);
 394         }
 395     }
 396 
 397 
 398     /**
 399      * Affixes a small system-provided progress bar to this application's icon.
 400      *
 401      * @param value from 0 to 100, other to disable progress indication
 402      * @throws SecurityException if a security manager exists and it denies the
 403      * {@code RuntimePermission("canProcessApplicationEvents")} permission.
 404      * @throws UnsupportedOperationException if the current platform
 405      * does not support the {@link Taskbar.Feature#PROGRESS_VALUE} feature
 406      */
 407     public void setProgressValue(int value) {
 408         checkEventsProcessingPermission();
 409         checkFeatureSupport(Feature.PROGRESS_VALUE);
 410         peer.setProgressValue(value);
 411     }
 412 
 413     /**
 414      * Displays a determinate progress bar in the task area for the specified
 415      * window.
 416      *
 417      * Has no effect if this window is not visible in the task area.
 418      * <br>
 419      * The visual behavior is platform and {@link State} dependent.
 420      * <br>
 421      * This call cancels the {@link State#INDETERMINATE INDETERMINATE} state
 422      * of the window.
 423      * <br>
 424      * Note that when multiple windows is grouped in the task area
 425      * the behavior is platform specific.
 426      *
 427      * @param f frame to update
 428      * @param value from 0 to 100, other to switch to {@link State#OFF} state
 429      *              and disable progress indication
 430      * @see #setWindowProgressState(java.awt.Frame, State)
 431      * @throws SecurityException if a security manager exists and it denies the
 432      * {@code RuntimePermission("canProcessApplicationEvents")} permission.
 433      * @throws UnsupportedOperationException if the current platform
 434      * does not support the {@link Taskbar.Feature#PROGRESS_VALUE_WINDOW} feature
 435      */
 436     public void setWindowProgressValue(Frame f, int value) {
 437         checkEventsProcessingPermission();
 438         checkFeatureSupport(Feature.PROGRESS_VALUE_WINDOW);
 439         if (f != null) {
 440             peer.setWindowProgressValue(f, value);
 441         }
 442     }
 443 
 444     /**
 445      * Sets a progress state for a specified window.
 446      *
 447      * Has no effect if this window is not visible in the task area.
 448      * <br>
 449      * Each state displays a progress in a platform-dependent way.
 450      * <br>
 451      * Note than switching from {@link State#INDETERMINATE INDETERMINATE} state
 452      * to any of determinate states may reset value set by
 453      * {@link #setWindowProgressValue(java.awt.Window, int) setWindowProgressValue}
 454      *
 455      * @param f frame
 456      * @param state to change to
 457      * @see State#OFF
 458      * @see State#NORMAL
 459      * @see State#PAUSED
 460      * @see State#ERROR
 461      * @see State#INDETERMINATE
 462      * @see #setWindowProgressValue(java.awt.Frame, int)
 463      * @throws SecurityException if a security manager exists and it denies the
 464      * {@code RuntimePermission("canProcessApplicationEvents")} permission.
 465      * @throws UnsupportedOperationException if the current platform
 466      * does not support the {@link Taskbar.Feature#PROGRESS_STATE_WINDOW} feature
 467      */
 468     public void setWindowProgressState(Frame f, State state) {
 469         checkEventsProcessingPermission();
 470         checkFeatureSupport(Feature.PROGRESS_STATE_WINDOW);
 471         if (f != null) {
 472             peer.setWindowProgressState(f, state);
 473         }
 474     }
 475 }
< prev index next >