public final class DesktopUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static void |
beep()
Sound a beep, bell or other kind of audible alert, if supported by the
desktop system.
|
static void |
copyToClipboard(String text)
Copy a string of text to the default system clipboard.
|
static File |
getDocumentsFolder()
Get the default documents folder of the current user.
|
static File |
getPicturesFolder()
Get the default images folder of the current user.
|
static void |
main(String[] args) |
static boolean |
open(File file)
Open a file in the associated application, or a directory in the default
file manager.
|
static boolean |
open(URL url)
Open a URL in the default browser.
|
static void |
setProgress(Window window,
int percentage)
Indicates the progress of an operation in the form of a progress bar on
the task bar for supported systems; does nothing on unsupported systems.
|
static void |
setProgressDone(Window window)
Indicates that progress should no longer be displayed on the task bar for
supported systems; does nothing on unsupported systems.
|
static void |
setProgressError(Window window)
Indicates that an operation for which progress was being displayed on the
task bar for supported systems has failed, for example by turning the
progress bar red; does nothing on unsupported systems.
|
public static boolean open(File file)
file - The file or directory to open.true if the file or directory was successfully
opened.public static File getDocumentsFolder()
public static File getPicturesFolder()
public static boolean open(URL url)
url - The URL to open.true if the URL was successfully opened.public static void copyToClipboard(String text)
text - The text to copy to the clipboard.public static void setProgress(Window window, int percentage)
Once the operation has finished setProgressDone(Window) must
always be invoked to clear the progress display from the task bar.
window - The window of which to use the task bar icon to display the
progress.percentage - The progress to display out of 100.public static void setProgressDone(Window window)
window - The window of which the task bar icon was being used to
display progress.public static void setProgressError(Window window)
Once the operation has finished setProgressDone(Window) must
always be invoked to clear the progress error state from the task bar.
window - The window of which the task bar icon was being used to
display progress.public static void beep()
public static void main(String[] args) throws MalformedURLException
MalformedURLExceptionCopyright © 2011–2023 pepsoft.org. All rights reserved.