List of usage examples for java.awt GraphicsDevice getDefaultConfiguration
public abstract GraphicsConfiguration getDefaultConfiguration();
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) { JFrame f = new JFrame(); f.add(new JPanel() { @Override/* ww w. j a v a 2 s.c om*/ public Dimension getPreferredSize() { return new Dimension(320, 240); } }); f.pack(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice defaultScreen = ge.getDefaultScreenDevice(); Rectangle rect = defaultScreen.getDefaultConfiguration().getBounds(); int x = (int) rect.getMaxX() - f.getWidth(); int y = (int) rect.getMaxY() - f.getHeight(); f.setLocation(x, y); f.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JFrame f = new JFrame(); f.add(new JPanel() { @Override/* ww w.j a v a 2 s.c o m*/ public Dimension getPreferredSize() { return new Dimension(320, 240); } }); f.pack(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice defaultScreen = ge.getDefaultScreenDevice(); Rectangle rect = defaultScreen.getDefaultConfiguration().getBounds(); int x = (int) rect.getMaxX() - f.getWidth(); int y = 0; f.setLocation(x, y); f.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment(); Rectangle bounds = env.getMaximumWindowBounds(); System.out.println("Screen Bounds: " + bounds); GraphicsDevice screen = env.getDefaultScreenDevice(); GraphicsConfiguration config = screen.getDefaultConfiguration(); System.out.println("Screen Size : " + config.getBounds()); JFrame frame = new JFrame("Frame Info"); System.out.println("Frame Insets : " + frame.getInsets()); frame.setSize(200, 200);//www. jav a2s .c o m System.out.println("Frame Insets : " + frame.getInsets()); frame.setVisible(true); System.out.println("Frame Size : " + frame.getSize()); System.out.println("Frame Insets : " + frame.getInsets()); System.out.println("Content Size : " + frame.getContentPane().getSize()); }
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 w w . j a v a2 s . com centerOn(f, gc); f.setVisible(true); } }
From source file:Main.java
public static void main(String[] args) throws IOException { BufferedImage original = ImageIO.read(new URL("http://www.java2s.com/style/download.png")); GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice gd = ge.getDefaultScreenDevice(); GraphicsConfiguration gc = gd.getDefaultConfiguration(); BufferedImage rotated1 = create(original, -Math.PI / 2, gc); BufferedImage rotated2 = create(original, +Math.PI / 4, gc); BufferedImage rotated3 = create(original, Math.PI, gc); JPanel cp = new JPanel(); cp.add(new JLabel(new ImageIcon(original))); cp.add(new JLabel(new ImageIcon(rotated1))); cp.add(new JLabel(new ImageIcon(rotated2))); cp.add(new JLabel(new ImageIcon(rotated3))); JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setContentPane(cp);/*from ww w . ja v a 2 s .c o m*/ f.pack(); f.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { Point p1 = null;//w ww . j a va 2 s. com Point p2 = null; for (GraphicsDevice gd : GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices()) { if (p1 == null) { p1 = gd.getDefaultConfiguration().getBounds().getLocation(); } else if (p2 == null) { p2 = gd.getDefaultConfiguration().getBounds().getLocation(); } } if (p2 == null) { p2 = p1; } createFrameAtLocation(p1); createFrameAtLocation(p2); }
From source file:Main.java
public static void main(String[] argv) throws Exception { GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice gs = ge.getDefaultScreenDevice(); Button btn = new Button("OK"); btn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice gs = ge.getDefaultScreenDevice(); gs.setFullScreenWindow(null); }/*from www.ja v a 2 s. c om*/ }); Frame frame = new Frame(gs.getDefaultConfiguration()); Window win = new Window(frame); win.add(btn, BorderLayout.CENTER); try { gs.setFullScreenWindow(win); win.validate(); } finally { gs.setFullScreenWindow(null); } }
From source file:Main.java
static Rectangle getScreenBounds(final GraphicsDevice screenDevice) { return screenDevice.getDefaultConfiguration().getBounds(); }