protected void createAndShowGUI() { GamePanel gamePanel = new GamePanel(); gamePanel.setBackground(Color.WHITE); gamePanel.setPreferredSize(new Dimension(320, 240)); getContentPane().add(gamePanel); setDefaultCloseOperation(EXIT_ON_CLOSE); setTitle("Hello World!"); pack(); frameRate.initialize(); setVisible(true); }
protected void onPaint(Graphics g) { frameRate.calculate(); g.setColor(Color.BLACK); g.drawString(frameRate.getFrameRate(), 30, 30); repaint(); }