List of usage examples for java.awt GraphicsEnvironment getDefaultScreenDevice
public abstract GraphicsDevice getDefaultScreenDevice() throws HeadlessException;
From source file:Main.java
public static void main(String[] args) { GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice defaultScreen = ge.getDefaultScreenDevice(); GraphicsConfiguration[] configurations = defaultScreen.getConfigurations(); System.out.println("Default screen device: " + defaultScreen.getIDstring()); for (int i = 0; i < configurations.length; i++) { System.out.println(" Configuration " + (i + 1)); GraphicsConfiguration c = configurations[i]; System.out.println(" " + c.getColorModel()); System.out.println(" " + c.getBounds()); System.out.println(" " + c.getBufferCapabilities()); System.out.println(" " + c.getDefaultTransform()); System.out.println(" " + c.getDevice()); }// w w w .j a v a 2 s .c om }
From source file:Main.java
public static void main(String[] args) { JFrame f = new JFrame(); f.add(new JPanel() { @Override/* w w w . j a v a 2s .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 ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice screen = ge.getDefaultScreenDevice(); if (!screen.isFullScreenSupported()) { System.out.println("Full screen mode not supported"); System.exit(1);/*from w w w . j ava 2s . co m*/ } try { BufferedImage loadedpic = ImageIO.read(new File("your.jpg")); screen.setFullScreenWindow(new Main(loadedpic)); } catch (Exception e) { System.err.println(e.getMessage()); } }
From source file:MainClass.java
public static void main(String[] args) { GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice screen = ge.getDefaultScreenDevice(); if (!screen.isFullScreenSupported()) { System.out.println("Full screen mode not supported"); System.exit(1);/*from w w w . ja va 2s .c om*/ } try { BufferedImage loadedpic = ImageIO.read(new File("your.jpg")); screen.setFullScreenWindow(new MainClass(loadedpic)); } catch (Exception e) { System.err.println(e.getMessage()); } }
From source file:Test.java
public static void main(String[] args) { GraphicsEnvironment envmt = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice device = envmt.getDefaultScreenDevice(); if (!device.isWindowTranslucencySupported(WindowTranslucency.PERPIXEL_TRANSLUCENT)) { System.out.println("Translucent windows are not supported on your system."); System.exit(0);// www. j a v a2s. c o m } JFrame.setDefaultLookAndFeelDecorated(true); ApplicationWindow window = new ApplicationWindow(); window.setVisible(true); }
From source file:Test.java
License:asdf
public static void main(String[] args) { GraphicsEnvironment envmt = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice device = envmt.getDefaultScreenDevice(); if (!device.isWindowTranslucencySupported(WindowTranslucency.PERPIXEL_TRANSLUCENT)) { System.out.println("Shaped windows are not supported on" + "your system."); System.exit(0);/*from w ww. ja va2 s. co m*/ } ApplicationWindow window = new ApplicationWindow(); window.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);/*w w w . j a va 2s . c o m*/ f.pack(); f.setVisible(true); }
From source file:Test.java
public static void main(String[] args) { JFrame.setDefaultLookAndFeelDecorated(true); GraphicsEnvironment graphicsEnvironment = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice graphicsDevice = graphicsEnvironment.getDefaultScreenDevice(); if (!graphicsDevice.isWindowTranslucencySupported(GraphicsDevice.WindowTranslucency.TRANSLUCENT)) { System.err.println("Translucency is not supported on this platform"); System.exit(0);//from w w w .jav a 2s. c o m } ApplicationWindow window = new ApplicationWindow(); window.setOpacity(0.75f); window.setVisible(true); }
From source file:misc.TranslucentWindowDemo.java
public static void main(String[] args) { // Determine if the GraphicsDevice supports translucency. GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice gd = ge.getDefaultScreenDevice(); //If translucent windows aren't supported, exit. if (!gd.isWindowTranslucencySupported(TRANSLUCENT)) { System.err.println("Translucency is not supported"); System.exit(0);//from ww w .j ava 2 s. c om } JFrame.setDefaultLookAndFeelDecorated(true); // Create the GUI on the event-dispatching thread SwingUtilities.invokeLater(new Runnable() { @Override public void run() { TranslucentWindowDemo tw = new TranslucentWindowDemo(); // Set the window to 55% opaque (45% translucent). tw.setOpacity(0.55f); // Display the window. tw.setVisible(true); } }); }
From source file:misc.GradientTranslucentWindowDemo.java
public static void main(String[] args) { // Determine what the GraphicsDevice can support. GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice gd = ge.getDefaultScreenDevice(); boolean isPerPixelTranslucencySupported = gd.isWindowTranslucencySupported(PERPIXEL_TRANSLUCENT); //If translucent windows aren't supported, exit. if (!isPerPixelTranslucencySupported) { System.out.println("Per-pixel translucency is not supported"); System.exit(0);/* ww w . j a v a2 s . c o m*/ } JFrame.setDefaultLookAndFeelDecorated(true); // Create the GUI on the event-dispatching thread SwingUtilities.invokeLater(new Runnable() { @Override public void run() { GradientTranslucentWindowDemo gtw = new GradientTranslucentWindowDemo(); // Display the window. gtw.setVisible(true); } }); }