public class Taskbar extends Object
Taskbar class allows a Java application to interact with
the system task area (taskbar, Dock, etc.).
There are a variety of interactions depending on the current platform such as displaying progress of some task, appending user-specified menu to the application icon context menu, etc.
java.desktop.appName system property set to this .desktop
file name:
Exec=java -Djava.desktop.appName=MyApp.desktop -jar /path/to/myapp.jar
see
https://help.ubuntu.com/community/UnityLaunchersAndDesktopFiles| Modifier and Type | Class | Description |
|---|---|---|
static class |
Taskbar.Feature |
List of provided features.
|
static class |
Taskbar.State |
Kinds of available window progress states.
|
| Modifier and Type | Method | Description |
|---|---|---|
Image |
getIconImage() |
Obtains an image of this application's icon.
|
PopupMenu |
getMenu() |
Gets PopupMenu used to add items to this application's icon in system task area.
|
static Taskbar |
getTaskbar() |
Returns the
Taskbar instance of the current
taskbar context. |
boolean |
isSupported(Taskbar.Feature feature) |
Tests whether a
Feature is supported on the current platform. |
static boolean |
isTaskbarSupported() |
Tests whether this class is supported on the current platform.
|
void |
requestUserAttention(boolean enabled,
boolean critical) |
Requests user attention to this application.
|
void |
requestWindowUserAttention(Window w) |
Requests user attention to the specified window.
|
void |
setIconBadge(String badge) |
Affixes a small system-provided badge to this application's icon.
|
void |
setIconImage(Image image) |
Changes this application's icon to the provided image.
|
void |
setMenu(PopupMenu menu) |
Attaches the contents of the provided PopupMenu to the application icon
in the task area.
|
void |
setProgressValue(int value) |
Affixes a small system-provided progress bar to this application's icon.
|
void |
setWindowIconBadge(Window w,
Image badge) |
Affixes a small badge to this application's icon in the task area
for the specified window.
|
void |
setWindowProgressState(Window w,
Taskbar.State state) |
Sets a progress state for a specified window.
|
void |
setWindowProgressValue(Window w,
int value) |
Displays a determinate progress bar in the task area for the specified
window.
|
public boolean isSupported(Taskbar.Feature feature)
Feature is supported on the current platform.feature - the specified Taskbar.Featurepublic static Taskbar getTaskbar()
Taskbar instance of the current
taskbar context. On some platforms the Taskbar API may not be
supported; use the isTaskbarSupported() method to
determine if the current taskbar is supported.HeadlessException - if GraphicsEnvironment.isHeadless() returns trueUnsupportedOperationException - if this class is not
supported on the current platformisTaskbarSupported(),
GraphicsEnvironment.isHeadless()public static boolean isTaskbarSupported()
getTaskbar() to retrieve an
instance.true if this class is supported on the
current platform; false otherwisegetTaskbar()public void requestUserAttention(boolean enabled,
boolean critical)
enabled to false.
Other platforms may require an additional call
requestUserAttention(boolean, boolean) to dismiss this request
with enabled parameter set to false.enabled - disables this request if falsecritical - if this is an important requestSecurityException - if a security manager exists and it denies the
RuntimePermission("canProcessApplicationEvents") permission.UnsupportedOperationException - if the current platform
does not support the Taskbar.Feature.USER_ATTENTION featurepublic void requestWindowUserAttention(Window w)
w - windowSecurityException - if a security manager exists and it denies the
RuntimePermission("canProcessApplicationEvents") permission.UnsupportedOperationException - if the current platform
does not support the Taskbar.Feature.USER_ATTENTION_WINDOW featurepublic void setMenu(PopupMenu menu)
menu - the PopupMenu to attach to this applicationSecurityException - if a security manager exists and it denies the
RuntimePermission("canProcessApplicationEvents") permission.UnsupportedOperationException - if the current platform
does not support the Taskbar.Feature.MENU featurepublic PopupMenu getMenu()
SecurityException - if a security manager exists and it denies the
RuntimePermission("canProcessApplicationEvents") permission.UnsupportedOperationException - if the current platform
does not support the Taskbar.Feature.MENU featurepublic void setIconImage(Image image)
image - to changeSecurityException - if a security manager exists and it denies the
RuntimePermission("canProcessApplicationEvents") permission.UnsupportedOperationException - if the current platform
does not support the Taskbar.Feature.ICON_IMAGE featurepublic Image getIconImage()
SecurityException - if a security manager exists and it denies the
RuntimePermission("canProcessApplicationEvents") permission.UnsupportedOperationException - if the current platform
does not support the Taskbar.Feature.ICON_IMAGE featurepublic void setIconBadge(String badge)
Feature.ICON_BADGE_TEXT and
Feature.ICON_BADGE_NUMBER.
Passing null as parameter hides the badge.badge - label to affix to the iconSecurityException - if a security manager exists and it denies the
RuntimePermission("canProcessApplicationEvents") permission.UnsupportedOperationException - if the current platform
does not support the Taskbar.Feature.ICON_BADGE_NUMBER
or Taskbar.Feature.ICON_BADGE_TEXT featurepublic void setWindowIconBadge(Window w, Image badge)
w - window to updatebadge - image to affix to the iconSecurityException - if a security manager exists and it denies the
RuntimePermission("canProcessApplicationEvents") permission.UnsupportedOperationException - if the current platform
does not support the Taskbar.Feature.ICON_BADGE_IMAGE_WINDOW featurepublic void setProgressValue(int value)
value - from 0 to 100, other to disable progress indicationSecurityException - if a security manager exists and it denies the
RuntimePermission("canProcessApplicationEvents") permission.UnsupportedOperationException - if the current platform
does not support the Taskbar.Feature.PROGRESS_VALUE featurepublic void setWindowProgressValue(Window w, int value)
Taskbar.State dependent.
INDETERMINATE state
of the window.
w - window to updatevalue - from 0 to 100, other to switch to Taskbar.State.OFF state
and disable progress indicationSecurityException - if a security manager exists and it denies the
RuntimePermission("canProcessApplicationEvents") permission.UnsupportedOperationException - if the current platform
does not support the Taskbar.Feature.PROGRESS_VALUE_WINDOW featuresetWindowProgressState(java.awt.Window, State)public void setWindowProgressState(Window w, Taskbar.State state)
INDETERMINATE state
to any of determinate states may reset value set by
setWindowProgressValuew - windowstate - to change toSecurityException - if a security manager exists and it denies the
RuntimePermission("canProcessApplicationEvents") permission.UnsupportedOperationException - if the current platform
does not support the Taskbar.Feature.PROGRESS_STATE_WINDOW featureTaskbar.State.OFF,
Taskbar.State.NORMAL,
Taskbar.State.PAUSED,
Taskbar.State.ERROR,
Taskbar.State.INDETERMINATE,
setWindowProgressValue(java.awt.Window, int) Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2017, Oracle and/or its affiliates. 500 Oracle Parkway
Redwood Shores, CA 94065 USA. All rights reserved.
DRAFT 9-Debian+0-9b155-1