JDIC API V0.9 Release 4

org.jdesktop.jdic.desktop
Class Desktop

java.lang.Object
  extended by org.jdesktop.jdic.desktop.Desktop

public class Desktop
extends java.lang.Object

The Desktop class provides several methods to interact with the system applications and facilities. It cannot be instantiated.

The methods include invoking system programs associated with a particular file type, invoking the system default browser to show a given URL, invoking the system default mailer with or without a constructed Message object, and making use of the printer to print a given file.

See Also:
Message, DesktopException

Method Summary
static void browse(java.net.URL url)
          Launches the system default browser to show the given URL.
static void edit(java.io.File file)
          Launches the associated editor to edit the given file.
static boolean isEditable(java.io.File file)
          Tests whether the given file is editable.
static boolean isPrintable(java.io.File file)
          Tests whether the given file could be printed.
static void mail()
          Launches the message compose window of the default mailer.
static void mail(Message msg)
          Launches the message compose window of the default mailer, and fills in the message fields with the field values of the given Message object.
static void open(java.io.File file)
          Launches the associated application to open a file
static void print(java.io.File file)
          Prints the given file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

open

public static void open(java.io.File file)
                 throws DesktopException
Launches the associated application to open a file

If the specified file is a directory, the file manager of the current platform is launched to open it.

Parameters:
file - the given file.
Throws:
DesktopException - If the specified file has no associated application, or the associated application fails to be launched.

isPrintable

public static boolean isPrintable(java.io.File file)
Tests whether the given file could be printed.

Parameters:
file - the given file.
Returns:
true if the given file is valid and is printable; false otherwise.

print

public static void print(java.io.File file)
                  throws DesktopException
Prints the given file.

Parameters:
file - the given file.
Throws:
DesktopException - if the given file is not valid, or the given file is not printable, or the given file fails to be printed.

isEditable

public static boolean isEditable(java.io.File file)
Tests whether the given file is editable.

Parameters:
file - the given file.
Returns:
true if the given file is valid and has an associated editor; false otherwise.

edit

public static void edit(java.io.File file)
                 throws DesktopException
Launches the associated editor to edit the given file.

Parameters:
file - the given file.
Throws:
DesktopException - if the given file is not valid, or the given file is not editable, or the given editor fails to be launched.

browse

public static void browse(java.net.URL url)
                   throws DesktopException
Launches the system default browser to show the given URL.

Parameters:
url - the given URL.
Throws:
DesktopException - if the given url is null, or the system default browser is not found, or the system browser fails to be launched.

mail

public static void mail()
                 throws DesktopException
Launches the message compose window of the default mailer.

Throws:
DesktopException - if the system default mailer was not found, or it fails to be launched.

mail

public static void mail(Message msg)
                 throws DesktopException
Launches the message compose window of the default mailer, and fills in the message fields with the field values of the given Message object.

Parameters:
msg - the constructed Message object.
Throws:
DesktopException - if the given message object is null, or the system default mailer was not found, or it fails to be launched.

JDIC API V0.9 Release 4

For more information and documentation on JDIC, see JDIC website.

That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, working code examples, license terms and bug report information.

Copyright (c) 2004 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.