I was following a tutorial exactly, i made sure everything looked the same but it still doesnt work.
I am using the latest version of NetBeans 7.3.1
package javagame; import java.awt.Graphics; import java.awt.Image; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import javax.swing.JFrame; public class JavaGame extends JFrame { int x, y; private Image dbImage; private Graphics dbg; public class AL extends KeyAdapter { public void KeyPressed(KeyEvent e){ int KeyCode = e.getKeyCode(); if(KeyCode == e.VK_LEFT) { x--; } if(KeyCode == e.VK_RIGHT) { x++; } if(KeyCode == e.VK_UP) { y--; } if(KeyCode == e.VK_DOWN) { y++; } } public void KeyReleased (KeyEvent e) { } } public JavaGame (){ addKeyListener(new JavaGame.AL()); setTitle("Java Game"); setSize(500, 500); setResizable(true); setVisible(true); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); x = 150; y = 150; } public void paint(Graphics g){ dbImage = createImage(getWidth(), getHeight()); dbg = dbImage.getGraphics(); paintComponent(dbg); g.drawImage(dbImage, 0, 0, this); } public void paintComponent(Graphics g){ g.fillOval(x, y, 15, 15); repaint(); } public static void main(String[] args){ new JavaGame(); } }