//-*-java-*- Worms { (@ Worm yin = new Worm(this); Worm yang = new Worm(this); Worm ynot = new Worm(this); private static final Color color = new Color(0xCC, 0xEE, 0xEE); static final int WIDTH = 480; static final int HEIGHT = 360; @) public static void main(String [] args) (@ new Worms(); @) init (@ setBackground(color); setSize(new Dimension(WIDTH, HEIGHT)); setTitle("Worms Demo"); setVisible(true); addWindowListener(new WinAdpt()); off_image = createImage(getSize().width, getSize().height); new Thread(yin).start(); new Thread(yang).start(); new Thread(ynot).start(); @) (@ private Image off_image; private Graphics off_graph; @) public void paint(Graphics g) (@ yin.draw(g); yang.draw(g); ynot.draw(g); @) public void update(Graphics g) (@ off_graph = off_image.getGraphics(); off_graph.setColor(color); off_graph.fillRect(0, 0, getSize().width, getSize().height); paint(off_graph); off_graph.dispose(); g.drawImage(off_image, 0, 0, this); @) (@ class WinAdpt extends WindowAdapter { public void windowClosing(WindowEvent e){ dispose(); System.exit(0); } } @) }