public static void main(String[] args) { // TODO Auto-generated method stub JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Animation panel = new Animation(); frame.getContentPane().add(panel); frame.pack(); frame.setVisible(true); frame.setFocusable(false); if (!panel.isFocusOwner()) panel.requestFocus(); }