Create buffered images that are compatible with the screen : Graphic Environment « 2D Graphics GUI « Java






Create buffered images that are compatible with the screen

  


import java.awt.GraphicsConfiguration;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.Transparency;
import java.awt.image.BufferedImage;

public class Main {
  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);

  }
}

   
    
  








Related examples in the same category

1.A quick utility to print out graphic device informationA quick utility to print out graphic device information
2.List all available fonts in the systemList all available fonts in the system
3.Show all fonts you have in your systemShow all fonts you have in your system
4.Determine if full-screen mode is supported directly
5.Leave full-screen mode (Return to normal windowed mode)
6.Enter full screen mode
7.Getting Screen Sizes
8.Getting Refresh Rates
9.Getting Number of Colors
10.Getting the Current Screen Refresh Rate and Number of Colors
11.Listing All Available Font Families
12.Getting the Font Faces for a Font Family
13.Create an image that does not support transparency from GraphicsConfiguration
14.Create an image that supports transparent pixels from GraphicsConfiguration
15.Getting Amount of Free Accelerated Image Memory
16.Get the available font family names
17.Get the available font names
18.Retrieve and print the graphic device information
19.Create an image that supports arbitrary levels of transparency from GraphicsConfiguration
20.Setting the Screen Size, Refresh Rate, or Number of Colors
21.If more than one screen is available, gets the size of each screen
22.Getting the Number of Screens
23.Get the GraphicsEnvironment and GraphicsDeviceGet the GraphicsEnvironment and GraphicsDevice
24.extends JComponent to exercise Graphics