public void keyPressed(KeyEvent e) {
                MazewarPacket packetToOthers = new MazewarPacket();
                packetToOthers.name = name;
                // If the user pressed Q, invoke the cleanup code and quit. 
                if((e.getKeyChar() == 'q') || (e.getKeyChar() == 'Q')) {
                        packetToOthers.type = MazewarPacket.MAZEWAR_BYE;
                        clientBroadcastQueue.add (packetToOthers);
                        //Mazewar.unregisterClient (name);
                        Mazewar.quit();
                // Up-arrow moves forward.
                } else if(e.getKeyCode() == KeyEvent.VK_UP) {
                        packetToOthers.type = MazewarPacket.MAZEWAR_REQ;
                        packetToOthers.command = MazewarPacket.MAZEWAR_MOVEFORWARD;
                        clientBroadcastQueue.add (packetToOthers);
                        //forward();
                // Down-arrow moves backward.
                } else if(e.getKeyCode() == KeyEvent.VK_DOWN) {
                        packetToOthers.type = MazewarPacket.MAZEWAR_REQ;
                        packetToOthers.command = MazewarPacket.MAZEWAR_MOVEBACKWARD;
                        clientBroadcastQueue.add (packetToOthers);
                        //backup();
                // Left-arrow turns left.
                } else if(e.getKeyCode() == KeyEvent.VK_LEFT) {
                        packetToOthers.type = MazewarPacket.MAZEWAR_REQ;
                        packetToOthers.command = MazewarPacket.MAZEWAR_ROTATELEFT;
                        clientBroadcastQueue.add (packetToOthers);
                        //turnLeft();
                // Right-arrow turns right.
                } else if(e.getKeyCode() == KeyEvent.VK_RIGHT) {
                        packetToOthers.type = MazewarPacket.MAZEWAR_REQ;
                        packetToOthers.command = MazewarPacket.MAZEWAR_ROTATERIGHT;
                        clientBroadcastQueue.add (packetToOthers);
                // Spacebar fires.
                } else if(e.getKeyCode() == KeyEvent.VK_SPACE) {
                        packetToOthers.type = MazewarPacket.MAZEWAR_REQ;
                        packetToOthers.command = MazewarPacket.MAZEWAR_FIRE;
                        clientBroadcastQueue.add (packetToOthers);
                        //fire();
                }
        }