Java 8 GraphicsEnvironment - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 GraphicsEnvironment class.

This code example shows how to use the following methods:getDefaultScreenDevice
 */ 
public class GraphicsManager { 
 
    /** get GraphicConfiguration for default screen - this should only be done once at startup **/ 
    private static GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    private static GraphicsDevice gs = ge.getDefaultScreenDevice();
    public static GraphicsConfiguration gc = gs.getDefaultConfiguration();
    private static final int MAX_RECYCLED_IMAGES = 50;
    private static int numRecycledImages = 0;
    private static HashMap<Dimension, List<BufferedImage>> recycledImages = new HashMap<Dimension, List<BufferedImage>>();
 
    /** 
     * Functionally equivalent to 
     *   gc.createCompatibleImage(width, height, Transparency.TRANSLUCENT) 
     * but allows reusing released images. 
     */ 
    public static BufferedImage getGCCompatibleImage(int width, int height) {
        List<BufferedImage> imgList = recycledImages.get(new Dimension(width, height));
        if (imgList == null || imgList.isEmpty()) {
            return gc.createCompatibleImage(width, height, Transparency.TRANSLUCENT);
4
CodeRank
This code example shows how to use the following methods:getDefaultScreenDevice
 
	final public static GraphicsEnvironment environment = GraphicsEnvironment
			.getLocalGraphicsEnvironment();
 
	final public static GraphicsDevice graphicsDevice = environment
			.getDefaultScreenDevice();
 
	final public static GraphicsConfiguration graphicsConfiguration = graphicsDevice
			.getDefaultConfiguration();
 
	/** 
	 * 查询可用的屏幕设备 
	 *  
	 * @param width 
	 * @param height 
	 * @return 
	 */ 
	public final static DisplayMode searchFullScreenModeDisplay(int width,
			int height) {
		return searchFullScreenModeDisplay(graphicsDevice, width, height);
4
CodeRank
This code example shows how to use the following methods:getScreenDevices
    /** 
     * Private constructor for Singleton. 
     */ 
    private DetectGraphicsDevices() {  
        graphicsEnv = GraphicsEnvironment.getLocalGraphicsEnvironment();
        graphicsDevices = graphicsEnv.getScreenDevices();
    } 
     
    /** 
     * Determines whether graphics device environment is headless or not. 
     *  
     * @return isHeadless - boolean (default is false) 
     */ 
    public boolean isGraphicsEnvHeadless() { 
        // Tests whether the display (or keyboard, mouse) an be supported within this GraphicsEnvironment 
        // If true, then HeadlessException is thrown and GraphicsEnv cannot support display; false otherwise  
        boolean isHeadless = false;
         
        try { 
             
3
CodeRank
See Code Examples for Java 8 GraphicsEnvironment Methods: