import java.awt.*;import java.awt.event.*;import java.awt.image.*;public class Test2 extends Frame{ volatile boolean running = true; public Test2() { enableEvents(AWTEvent.KEY_EVENT_MASK); setUndecorated(true); GraphicsDevice gd = getGraphicsConfiguration().getDevice(); gd.setFullScreenWindow(this); gd.setDisplayMode(new DisplayMode(800,600,16,60)); createBufferStrategy(2); int frameCount =0; long lastTime = System.currentTimeMillis(); String frameRate = "N/A"; while(running) { if(System.currentTimeMillis()-lastTime>1000) { lastTime = System.currentTimeMillis(); System.out.println(String.valueOf(frameCount)); frameCount=0; } BufferStrategy bs = getBufferStrategy(); frameCount++; getBufferStrategy().show(); } dispose(); } public void processKeyEvent(KeyEvent ke) { if(ke.getKeyCode()==KeyEvent.VK_ESCAPE) running = false; } public static void main(String [] args) { new Test2(); }}