Example usage for java.awt Desktop getDesktop

List of usage examples for java.awt Desktop getDesktop

Introduction

In this page you can find the example usage for java.awt Desktop getDesktop.

Prototype

public static synchronized Desktop getDesktop() 

Source Link

Document

Returns the Desktop instance of the current desktop context.

Usage

From source file:Main.java

public static void main(String[] args) throws Exception {
    File f = new File("c:\\temp\\test.bmp");
    Desktop dt = Desktop.getDesktop();
    dt.open(f);/*  ww  w.j a va 2s  .  c  om*/
    System.out.println("Done.");
}

From source file:Main.java

public static void main(String[] a) throws Exception {
    Desktop desktop = null;/*from  w  w w . j av a2 s . c  o  m*/
    if (Desktop.isDesktopSupported()) {
        desktop = Desktop.getDesktop();
    }

    desktop.mail();
}

From source file:Test.java

public static void main(String[] a) throws Exception {
    Desktop desktop = null;/*from   w  w w  . j a v a 2 s. c om*/
    if (Desktop.isDesktopSupported()) {
        desktop = Desktop.getDesktop();
    }

    desktop.mail("mailto", "a@a.net", null);
}

From source file:Main.java

public static void main(String[] a) {
    try {//from w ww  .ja  v  a2  s  .  com
        Desktop desktop = null;
        if (Desktop.isDesktopSupported()) {
            desktop = Desktop.getDesktop();
        }

        desktop.edit(new File("c:\\a.txt"));
    } catch (IOException ioe) {
        ioe.printStackTrace();
    }

}

From source file:Test.java

public static void main(String[] a) {
    try {/*from  ww w . j  av  a 2 s. c  om*/
        Desktop desktop = null;
        if (Desktop.isDesktopSupported()) {
            desktop = Desktop.getDesktop();
        }

        desktop.open(new File("c:\\a.doc"));
    } catch (IOException ioe) {
        ioe.printStackTrace();
    }

}

From source file:Test.java

public static void main(String[] a) {
    try {//w  w  w  .  jav a 2  s .  c  o  m
        Desktop desktop = null;
        if (Desktop.isDesktopSupported()) {
            desktop = Desktop.getDesktop();
        }

        desktop.print(new File("c:\\a.txt"));
    } catch (IOException ioe) {
        ioe.printStackTrace();
    }

}

From source file:Test.java

public static void main(String[] a) {
    try {//from w w w .  j a  va2  s.  c om
        Desktop desktop = null;
        if (Desktop.isDesktopSupported()) {
            desktop = Desktop.getDesktop();
        }

        desktop.open(new File("c:\\a.txt"));
    } catch (IOException ioe) {
        ioe.printStackTrace();
    }

}

From source file:Main.java

public static void main(String[] a) throws URISyntaxException {
    try {/*from   www  .j a  va 2 s .  c  o m*/
        Desktop desktop = null;
        if (Desktop.isDesktopSupported()) {
            desktop = Desktop.getDesktop();
        }

        desktop.mail(new URI("name@address.net"));
    } catch (IOException ioe) {
        ioe.printStackTrace();
    }

}

From source file:Main.java

public static void main(String[] a) {
    try {// ww w .j  a  v  a  2 s. c  om
        URI uri = new URI("http://www.java2s.com");
        Desktop desktop = null;
        if (Desktop.isDesktopSupported()) {
            desktop = Desktop.getDesktop();
        }

        if (desktop != null)
            desktop.browse(uri);
    } catch (IOException ioe) {
        ioe.printStackTrace();
    } catch (URISyntaxException use) {
        use.printStackTrace();
    }

}

From source file:Main.java

public static void main(String[] a) {
    try {/*from  ww  w .j  a v a 2s.c  o m*/
        URI uri = new URI("http://www.java2s.com");
        Desktop desktop = null;
        if (Desktop.isDesktopSupported()) {
            desktop = Desktop.getDesktop();
            desktop.isSupported(Desktop.Action.PRINT);
        }

        if (desktop != null)
            desktop.browse(uri);
    } catch (IOException ioe) {
        ioe.printStackTrace();
    } catch (URISyntaxException use) {
        use.printStackTrace();
    }

}