API Overview API Index Package Overview Direct link to this page
JDK 1.6
  java.awt.peer. DesktopPeer View Javadoc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88

/*
 * @(#)DesktopPeer.java
 *
 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
 * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */

package java.awt.peer;


import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.awt.Desktop.Action;

/**
 * The <code>DesktopPeer</code> interface provides methods for the operation
 * of open, edit, print, browse and mail with the given URL or file, by 
 * launching the associated application. 
 * <p>
 * Each platform has an implementation class for this interface.
 * 
 */
public interface DesktopPeer {    
    /**
     * Returns whether the given action is supported on the current platform. 
     * @param action the action type to be tested if it's supported on the 
     *        current platform. 
     * @return <code>true</code> if the given action is supported on 
     *         the current platform; <code>false</code> otherwise.
     */    
    public boolean isSupported(Action action);

    /**
     * Launches the associated application to open the given file. The 
     * associated application is registered to be the default file viewer for 
     * the file type of the given file. 
     * 
     * @param file the given file.
     * @throws IOException If the given file has no associated application, 
     *         or the associated application fails to be launched.          
     */
    public void open(File file) throws IOException;
    
    /**
     * Launches the associated editor and opens the given file for editing. The 
     * associated editor is registered to be the default editor for the file 
     * type of the given file. 
     *
     * @param file the given file.
     * @throws IOException If the given file has no associated editor, or 
     *         the associated application fails to be launched. 
     */
    public void edit(File file) throws IOException;
    
    /**
     * Prints the given file with the native desktop printing facility, using 
     * the associated application's print command.
     *
     * @param file the given file.
     * @throws IOException If the given file has no associated application 
     *         that can be used to print it.
     */
    public void print(File file) throws IOException;
    
    /**
     * Launches the mail composing window of the user default mail client, 
     * filling the message fields including to, cc, etc, with the values 
     * specified by the given mailto URL. 
     * 
     * @param uri represents a mailto URL with specified values of the message.
     *        The syntax of mailto URL is defined by 
     *        <a href="http://www.ietf.org/rfc/rfc2368.txt">RFC2368: The mailto 
     *        URL scheme</a>
     * @throws IOException If the user default mail client is not found, 
     *         or it fails to be launched.
     */
    public void mail(URI mailtoURL) throws IOException;
    
    /**
     * Launches the user default browser to display the given URI. 
     *
     * @param uri the given URI.
     * @throws IOException If the user default browser is not found, 
     *         or it fails to be launched.
     */
    public void browse(URI url) throws IOException;
}

Generated By: JavaOnTracks Doclet 0.1.4     ©Thibaut Colar