Can you help me refactor this code:
public void keyPressed(KeyEvent e)
{
if (e.getKeyCode()==39)
{
//Right arrow key code
}
else if (e.getKeyCode()==37)
{
//Left arrow key code
}
repaint();
}
Please mention how to check for up/down arrow keys as well.Thanks!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…