Example usage for java.awt GraphicsEnvironment getLocalGraphicsEnvironment

List of usage examples for java.awt GraphicsEnvironment getLocalGraphicsEnvironment

Introduction

In this page you can find the example usage for java.awt GraphicsEnvironment getLocalGraphicsEnvironment.

Prototype

public static GraphicsEnvironment getLocalGraphicsEnvironment() 

Source Link

Document

Returns the local GraphicsEnvironment .

Usage

From source file:Main.java

public static void main(String[] argv) throws Exception {
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice gs = ge.getDefaultScreenDevice();
    GraphicsConfiguration gc = gs.getDefaultConfiguration();

    BufferedImage bimage = gc.createCompatibleImage(100, 100, Transparency.BITMASK);

}

From source file:Main.java

public static void main(String[] argv) throws Exception {

    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice gs = ge.getDefaultScreenDevice();
    GraphicsConfiguration gc = gs.getDefaultConfiguration();

    BufferedImage bimage = gc.createCompatibleImage(100, 100, Transparency.OPAQUE);

}

From source file:Main.java

public static void main(String[] argv) throws Exception {

    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice gs = ge.getDefaultScreenDevice();
    GraphicsConfiguration gc = gs.getDefaultConfiguration();

    // Create an image that does not support transparency
    BufferedImage bimage = gc.createCompatibleImage(100, 100, Transparency.OPAQUE);

}

From source file:Main.java

public static void main(String[] argv) throws Exception {

    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice gs = ge.getDefaultScreenDevice();
    GraphicsConfiguration gc = gs.getDefaultConfiguration();

    // Create an image that does not support transparency
    BufferedImage bimage = gc.createCompatibleImage(100, 100);

}

From source file:Main.java

public static void main(String[] args) {
    GraphicsDevice[] sds = GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices();
    for (GraphicsDevice sd : sds) {
        System.out.println(sd.getIDstring());
        GraphicsConfiguration gc = sd.getDefaultConfiguration();
        JFrame f = new JFrame(gc);
        f.add(new JLabel(sd.getIDstring()));
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        f.pack();//from w  ww  . j  a  v a2  s  .c  om
        centerOn(f, gc);
        f.setVisible(true);
    }
}

From source file:Main.java

public static void main(String[] args) {
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();

    Rectangle vBounds = new Rectangle();

    GraphicsDevice[] gdArray = ge.getScreenDevices();

    for (int i = 0; i < gdArray.length; i++) {
        GraphicsDevice gd = gdArray[i];

        GraphicsConfiguration[] gcArray = gd.getConfigurations();

        for (int j = 0; j < gcArray.length; j++)
            vBounds = vBounds.union(gcArray[j].getBounds());
    }//  w  w w. jav a 2s. c  o  m

    Point origin = vBounds.getLocation();
    System.out.println("Virtual x = " + origin.x);
    System.out.println("Virtual y = " + origin.y);

    Dimension size = vBounds.getSize();
    System.out.println("Virtual width = " + size.width);
    System.out.println("Virtual height = " + size.height);
}

From source file:MainClass.java

public static void main(String[] args) {
    GraphicsEnvironment ge;//ww w  .ja  va  2  s  .c o  m
    ge = GraphicsEnvironment.getLocalGraphicsEnvironment();

    Rectangle vBounds = new Rectangle();

    GraphicsDevice[] gdArray = ge.getScreenDevices();

    for (int i = 0; i < gdArray.length; i++) {
        GraphicsDevice gd = gdArray[i];

        GraphicsConfiguration[] gcArray = gd.getConfigurations();

        for (int j = 0; j < gcArray.length; j++)
            vBounds = vBounds.union(gcArray[j].getBounds());
    }

    Point origin = vBounds.getLocation();
    System.out.println("Virtual x = " + origin.x);
    System.out.println("Virtual y = " + origin.y);

    Dimension size = vBounds.getSize();
    System.out.println("Virtual width = " + size.width);
    System.out.println("Virtual height = " + size.height);
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice gs = ge.getDefaultScreenDevice();
    gs.setFullScreenWindow(null);/*www.  j a v  a  2s.  c  o m*/
}

From source file:Main.java

public static void main(String[] args) {
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    String[] fonts = ge.getAvailableFontFamilyNames();
    JComboBox<String> fontChooser = new JComboBox<>(fonts);
    fontChooser.setRenderer(new FontCellRenderer());
    JOptionPane.showMessageDialog(null, fontChooser);

}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice gs = ge.getDefaultScreenDevice();
    if (gs.isFullScreenSupported()) {
        // Full-screen mode is supported
    } else {/*w ww  .j av a2 s . c  o m*/
        // Full-screen mode will be simulated
    }
}