List of usage examples for java.awt Window getBufferStrategy
public BufferStrategy getBufferStrategy()
From source file:Filter3dTest.java
/** * Gets the graphics context for the display. The ScreenManager uses double * buffering, so applications must call update() to show any graphics drawn. * <p>//w w w.ja v a2 s. c o m * The application must dispose of the graphics object. */ public Graphics2D getGraphics() { Window window = device.getFullScreenWindow(); if (window != null) { BufferStrategy strategy = window.getBufferStrategy(); return (Graphics2D) strategy.getDrawGraphics(); } else { return null; } }
From source file:Filter3dTest.java
/** * Updates the display./*from w ww . j av a 2 s . co m*/ */ public void update() { Window window = device.getFullScreenWindow(); if (window != null) { BufferStrategy strategy = window.getBufferStrategy(); if (!strategy.contentsLost()) { strategy.show(); } } // Sync the display on some systems. // (on Linux, this fixes event queue problems) Toolkit.getDefaultToolkit().sync(); }