import javax.swing.*; import java.awt.*; import java.awt.event.*; public class World extends JPanel implements KeyListener, ActionListener { Timer timer; public World(Game parent) { parent.addKeyListener(this); timer = new Timer(400, this); this.shape = new TShape(this); } public void keyPressed(KeyEvent e) { System.out.println( "... Key pressed: " + e ); } public void keyReleased(KeyEvent e) { System.out.println( "... Key typed: " + e ); } public void keyTyped(KeyEvent e) { System.out.println( "... Key typed: " + e ); } public void start() { // this.timer.start(); } public void actionPerformed(ActionEvent e) { System.out.println( e ); } Shape shape; public void paintComponent(Graphics g) { shape.draw(g); } int squareWidth() { return (int) getSize().getWidth() / BoardWidth; } int squareHeight() { return (int) getSize().getHeight() / BoardHeight; } final int BoardWidth = 10; final int BoardHeight = 22; }