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.
Implementation Note
Linux support is currently limited to Unity. However to make these
features work on Unity, the app should be run from a .desktop file with
specified 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 and Description |
|---|---|
| public static enum | Taskbar.
List of provided features. |
| public static enum | Taskbar.
Kinds of available window progress states. |
| Modifier and Type | Field and Description |
|---|---|
| private TaskbarPeer | |
| private static volatile Taskbar |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| private void | checkFeatureSupport(Taskbar.
the action type in question featureTypeChecks if the feature type is supported. |
| public Image | Returns: an image of this application's iconObtains an image of this application's icon. |
| public PopupMenu | Returns: the PopupMenuGets PopupMenu used to add items to this application's icon in system task area. |
| public static synchronized Taskbar | Returns: the Taskbar instanceReturns the |
| public boolean | Returns: true if the specified feature is supported on the current platformthe specified featureFeatureTests whether a |
| public static boolean | Returns: true if this class is supported on the
current platform; false otherwiseTests whether this class is supported on the current platform. |
| public void | requestUserAttention(final boolean
disables this request if false enabled, final boolean if this is an important request critical)Requests user attention to this application. |
| public void | |
| public void | setIconBadge(final String
label to affix to the icon badge)Affixes a small system-provided badge to this application's icon. |
| public void | setIconImage(final Image
to change image)Requests the system to change this application's icon to the provided |
| public void | |
| public void | setProgressValue(int
from 0 to 100, other to disable progress indication value)Affixes a small system-provided progress bar to this application's icon. |
| public void | setWindowIconBadge(Window
window to update w, final Image image to affix to the icon badge)Affixes a small badge to this application's icon in the task area for the specified window. |
| public void | setWindowProgressState(Window
window w, Taskbar.to change to stateSets a progress state for a specified window. |
| public void | setWindowProgressValue(Window
window to update w, int from 0 to 100, other to switch to value)State#OFF state
and disable progress indicationDisplays a determinate progress bar in the task area for the specified window. |
| peer | back to summary |
|---|---|
| private TaskbarPeer peer | |
| taskbar | back to summary |
|---|---|
| private static volatile Taskbar taskbar | |
| Taskbar | back to summary |
|---|---|
| private Taskbar() | |
| checkFeatureSupport | back to summary |
|---|---|
| private void checkFeatureSupport(Taskbar. Checks if the feature type is supported.
| |
| getIconImage | back to summary |
|---|---|
| public Image getIconImage() Obtains an image of this application's icon. API Note The returned icon image may not be equal
to an image set by
| |
| getMenu | back to summary |
|---|---|
| public PopupMenu getMenu() Gets PopupMenu used to add items to this application's icon in system task area.
| |
| getTaskbar | back to summary |
|---|---|
| public static synchronized Taskbar getTaskbar() Returns the
| |
| isSupported | back to summary |
|---|---|
| public boolean isSupported(Taskbar. Tests whether a | |
| isTaskbarSupported | back to summary |
|---|---|
| public static boolean isTaskbarSupported() Tests whether this class is supported on the current platform.
If it's supported, use
| |
| requestUserAttention | back to summary |
|---|---|
| public void requestUserAttention(final boolean enabled, final boolean critical) Requests user attention to this application.
Depending on the platform, this may be visually indicated by a bouncing
or flashing icon in the task area. It may have no effect on an already active
application.
On some platforms (e.g. Mac OS) this effect may disappear upon app activation
and cannot be dismissed by setting
| |
| requestWindowUserAttention | back to summary |
|---|---|
| public void requestWindowUserAttention(Window w) Requests user attention to the specified window. Has no effect if a window representation is not displayable in the task area. Whether it is displayable is dependent on all of window type, platform, and implementation.
| |
| setIconBadge | back to summary |
|---|---|
| public void setIconBadge(final String badge) Affixes a small system-provided badge to this application's icon.
Usually a number.
Some platforms do not support string values and accept only integer
values. In this case, pass an integer represented as a string as parameter.
This can be tested by
| |
| setIconImage | back to summary |
|---|---|
| public void setIconImage(final Image image) Requests the system to change this application's icon to the provided
| |
| setMenu | back to summary |
|---|---|
| public void setMenu(final PopupMenu menu) Attaches the contents of the provided PopupMenu to the application icon in the task area.
| |
| setProgressValue | back to summary |
|---|---|
| public void setProgressValue(int value) Affixes a small system-provided progress bar to this application's icon.
| |
| setWindowIconBadge | back to summary |
|---|---|
| public void setWindowIconBadge(Window w, final Image badge) Affixes a small badge to this application's icon in the task area for the specified window. It may be disabled by system settings. Has no effect if a window representation is not displayable in the task area. Whether it is displayable is dependent on all of window type, platform, and implementation.
| |
| setWindowProgressState | back to summary |
|---|---|
| public void setWindowProgressState(Window w, Taskbar. Sets a progress state for a specified window.
Has no effect if a window representation is not displayable in
the task area. Whether it is displayable is dependent on all
of window type, platform, and implementation.
| |
| setWindowProgressValue | back to summary |
|---|---|
| public void setWindowProgressValue(Window w, int value) Displays a determinate progress bar in the task area for the specified
window.
Has no effect if a window representation is not displayable in
the task area. Whether it is displayable is dependent on all
of window type, platform, and implementation.
| |
Taskbar#isSupported
method to determine if the given feature is supported by the
current platform.
| Modifier and Type | Field and Description |
|---|---|
| public static final Taskbar. | ICON_BADGE_IMAGE_WINDOW
Represents a graphical icon badge feature for a window. |
| public static final Taskbar. | ICON_BADGE_NUMBER
Represents a numerical icon badge feature. |
| public static final Taskbar. | ICON_BADGE_TEXT
Represents a textual icon badge feature. |
| public static final Taskbar. | ICON_IMAGE
Represents an icon feature. |
| public static final Taskbar. | MENU
Represents a menu feature. |
| public static final Taskbar. | PROGRESS_STATE_WINDOW
Represents a progress state feature for a specified window. |
| public static final Taskbar. | PROGRESS_VALUE
Represents a progress value feature. |
| public static final Taskbar. | PROGRESS_VALUE_WINDOW
Represents a progress value feature for a specified window. |
| public static final Taskbar. | USER_ATTENTION
Represents a user attention request feature. |
| public static final Taskbar. | USER_ATTENTION_WINDOW
Represents a user attention request feature for a specified window. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static Taskbar. | |
| public static Taskbar. |
| ICON_BADGE_IMAGE_WINDOW | back to summary |
|---|---|
| public static final Taskbar. Represents a graphical icon badge feature for a window. | |
| ICON_BADGE_NUMBER | back to summary |
|---|---|
| public static final Taskbar. Represents a numerical icon badge feature.
| |
| ICON_BADGE_TEXT | back to summary |
|---|---|
| public static final Taskbar. Represents a textual icon badge feature.
| |
| ICON_IMAGE | back to summary |
|---|---|
| public static final Taskbar. Represents an icon feature.
| |
| MENU | back to summary |
|---|---|
| public static final Taskbar. Represents a menu feature.
| |
| PROGRESS_STATE_WINDOW | back to summary |
|---|---|
| public static final Taskbar. Represents a progress state feature for a specified window. | |
| PROGRESS_VALUE | back to summary |
|---|---|
| public static final Taskbar. Represents a progress value feature.
| |
| PROGRESS_VALUE_WINDOW | back to summary |
|---|---|
| public static final Taskbar. Represents a progress value feature for a specified window. | |
| USER_ATTENTION | back to summary |
|---|---|
| public static final Taskbar. Represents a user attention request feature. | |
| USER_ATTENTION_WINDOW | back to summary |
|---|---|
| public static final Taskbar. Represents a user attention request feature for a specified window. | |
| Feature | back to summary |
|---|---|
| private Feature() | |
| valueOf | back to summary |
|---|---|
| public static Taskbar. | |
| values | back to summary |
|---|---|
| public static Taskbar. | |
| Modifier and Type | Field and Description |
|---|---|
| public static final Taskbar. | ERROR
Shows that an error has occurred. |
| public static final Taskbar. | INDETERMINATE
The progress indicator displays activity without specifying what proportion of the progress is complete. |
| public static final Taskbar. | NORMAL
The progress indicator displays with normal color and determinate mode. |
| public static final Taskbar. | OFF
Stops displaying the progress. |
| public static final Taskbar. | PAUSED
Shows progress as paused, progress can be resumed by the user. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static Taskbar. | |
| public static Taskbar. |
| ERROR | back to summary |
|---|---|
| public static final Taskbar. Shows that an error has occurred. Switches to the determinate display. | |
| INDETERMINATE | back to summary |
|---|---|
| public static final Taskbar. The progress indicator displays activity without specifying what proportion of the progress is complete. | |
| NORMAL | back to summary |
|---|---|
| public static final Taskbar. The progress indicator displays with normal color and determinate mode. | |
| OFF | back to summary |
|---|---|
| public static final Taskbar. Stops displaying the progress. | |
| PAUSED | back to summary |
|---|---|
| public static final Taskbar. Shows progress as paused, progress can be resumed by the user. Switches to the determinate display. | |
| State | back to summary |
|---|---|
| private State() | |
| valueOf | back to summary |
|---|---|
| public static Taskbar. | |
| values | back to summary |
|---|---|
| public static Taskbar. | |