|
Modifier and Type |
Method and Description |
|
browse |
void browse(java.net.URI uri)
Launches the default browser to display a URI .
public void browse(java.net.URI uri)
throws java.io.IOException
-
Launches the default browser to display a URI .
If the default browser is not able to handle the specified
URI , the application registered for handling
URIs of the specified type is invoked. The application
is determined from the protocol and path of the URI , as
defined by the URI class.
If the calling thread does not have the necessary permissions,
and this is invoked from within an applet,
AppletContext.showDocument() is used. Similarly, if the calling
does not have the necessary permissions, and this is invoked from within
a Java Web Started application, BasicService.showDocument()
is used.
- Parameters:
uri - the URI to be displayed in the user default browser
- Throws:
java.lang.NullPointerException - if uri is null
java.lang.UnsupportedOperationException - if the current platform
does not support the Desktop.Action.BROWSE action
java.io.IOException - if the user default browser is not found,
or it fails to be launched, or the default handler application
failed to be launched
java.lang.SecurityException - if a security manager exists and it
denies the
AWTPermission("showWindowWithoutWarningBanner")
permission, or the calling thread is not allowed to create a
subprocess; and not invoked from within an applet or Java Web Started
application
java.lang.IllegalArgumentException - if the necessary permissions
are not available and the URI can not be converted to a URL - See Also:
URI ,
AWTPermission ,
AppletContext
|
|
edit |
void edit(java.io.File file)
Launches the associated editor application and opens a file for
editing.
public void edit(java.io.File file)
throws java.io.IOException
-
Launches the associated editor application and opens a file for
editing.
- Parameters:
file - the file to be opened for editing
- Throws:
java.lang.NullPointerException - if the specified file is null
java.lang.IllegalArgumentException - if the specified file doesn't
exist
java.lang.UnsupportedOperationException - if the current platform
does not support the Desktop.Action.EDIT action
java.io.IOException - if the specified file has no associated
editor, or the associated application fails to be launched
java.lang.SecurityException - if a security manager exists and its
SecurityManager.checkRead(java.lang.String)
method denies read access to the file, or SecurityManager.checkWrite(java.lang.String) method
denies write access to the file, or it denies the
AWTPermission("showWindowWithoutWarningBanner")
permission, or the calling thread is not allowed to create a
subprocess- See Also:
AWTPermission
|
|
isSupported |
boolean isSupported(Desktop.Action action)
Tests whether an action is supported on the current platform.
-
Tests whether an action is supported on the current platform.
Even when the platform supports an action, a file or URI may
not have a registered application for the action. For example,
most of the platforms support the Desktop.Action.OPEN
action. But for a specific file, there may not be an
application registered to open it. In this case, isSupported(java.awt.Desktop.Action) may return true , but the corresponding
action method will throw an IOException .
- Parameters:
action - the specified Desktop.Action
- Returns:
true if the specified action is supported on
the current platform; false otherwise- See Also:
Desktop.Action
|
|
mail |
void mail()
Launches the mail composing window of the user default mail
client.
public void mail()
throws java.io.IOException
-
Launches the mail composing window of the user default mail
client.
- Throws:
java.lang.UnsupportedOperationException - if the current platform
does not support the Desktop.Action.MAIL action
java.io.IOException - if the user default mail client is not
found, or it fails to be launched
java.lang.SecurityException - if a security manager exists and it
denies the
AWTPermission("showWindowWithoutWarningBanner")
permission, or the calling thread is not allowed to create a
subprocess- See Also:
AWTPermission
|
|
mail |
void mail(java.net.URI mailtoURI)
Launches the mail composing window of the user default mail
client, filling the message fields specified by a mailto: URI.
public void mail(java.net.URI mailtoURI)
throws java.io.IOException
-
Launches the mail composing window of the user default mail
client, filling the message fields specified by a mailto: URI.
A mailto: URI can specify message fields
including "to", "cc", "subject",
"body", etc. See The mailto URL
scheme (RFC 2368) for the mailto: URI specification
details.
- Parameters:
mailtoURI - the specified mailto: URI
- Throws:
java.lang.NullPointerException - if the specified URI is null
java.lang.IllegalArgumentException - if the URI scheme is not
"mailto"
java.lang.UnsupportedOperationException - if the current platform
does not support the Desktop.Action.MAIL action
java.io.IOException - if the user default mail client is not
found or fails to be launched
java.lang.SecurityException - if a security manager exists and it
denies the
AWTPermission("showWindowWithoutWarningBanner")
permission, or the calling thread is not allowed to create a
subprocess- See Also:
URI ,
AWTPermission
|
|
open |
void open(java.io.File file)
Launches the associated application to open the file.
public void open(java.io.File file)
throws java.io.IOException
-
Launches the associated application to open the file.
If the specified file is a directory, the file manager of
the current platform is launched to open it.
- Parameters:
file - the file to be opened with the associated application
- Throws:
java.lang.NullPointerException - if file is null
java.lang.IllegalArgumentException - if the specified file doesn't
exist
java.lang.UnsupportedOperationException - if the current platform
does not support the Desktop.Action.OPEN action
java.io.IOException - if the specified file has no associated
application or the associated application fails to be launched
java.lang.SecurityException - if a security manager exists and its
SecurityManager.checkRead(java.lang.String)
method denies read access to the file, or it denies the
AWTPermission("showWindowWithoutWarningBanner")
permission, or the calling thread is not allowed to create a
subprocess- See Also:
AWTPermission
|
|
print |
void print(java.io.File file)
Prints a file with the native desktop printing facility, using
the associated application's print command.
public void print(java.io.File file)
throws java.io.IOException
-
Prints a file with the native desktop printing facility, using
the associated application's print command.
- Parameters:
file - the file to be printed
- Throws:
java.lang.NullPointerException - if the specified file is null
java.lang.IllegalArgumentException - if the specified file doesn't
exist
java.lang.UnsupportedOperationException - if the current platform
does not support the Desktop.Action.PRINT action
java.io.IOException - if the specified file has no associated
application that can be used to print it
java.lang.SecurityException - if a security manager exists and its
SecurityManager.checkRead(java.lang.String)
method denies read access to the file, or its SecurityManager.checkPrintJobAccess() method denies
the permission to print the file, or the calling thread is not
allowed to create a subprocess
|