Re: KeyListener not working
- From: "Andrew Thompson" <u32984@uwe>
- Date: Mon, 31 Dec 2007 02:32:32 GMT
Justin wrote:
I'm just messing around, getting ready to write a game for fun and
can't get this KeyListener to work. ...
See below.
package javaapplication1;
import javax.swing.JPanel;
import java.awt.event.KeyListener;
import java.awt.event.KeyEvent;
public class Board extends JPanel implements KeyListener{
private final int BOARD_WIDTH = 12;
private final int BOARD_HEIGHT = 20;
private final int BLOCK_SIZE = 10;
//private Piece pieceBoard[][] = new Piece[BOARD_WIDTH]
[BOARD_HEIGHT];
public Board() {
setPreferredSize(new java.awt.Dimension(BOARD_WIDTH *
BLOCK_SIZE, BOARD_HEIGHT * BLOCK_SIZE));
setSize(getPreferredSize());
setBackground(java.awt.Color.WHITE);
setLayout(null);
setFocusable(true);
...
--
Andrew Thompson
http://www.physci.org/
Message posted via JavaKB.com
http://www.javakb.com/Uwe/Forums.aspx/java-setup/200712/1
.
- References:
- KeyListener not working
- From: Justin
- KeyListener not working
- Prev by Date: Re: Copy files in java gives me out of memory error
- Next by Date: Re: Extremely slow when accessing file browsing dialog
- Previous by thread: KeyListener not working
- Next by thread: Re: KeyListener not working
- Index(es):
Relevant Pages
|