Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Eclipse: Java [ Not Detecting Key Pressed ]
Eclipse: Java [ Not Detecting Key Pressed ] [message #1702075] Sat, 18 July 2015 13:54
Eclipse UserFriend
Why wont Eclipse Detect Key pressed?

public void keyPressed(KeyEvent e) {
// TODO Auto-generated method stub
if (e.getKeyCode() == KeyEvent.VK_W)
{
rect.setLocation(rect.x+2, rect.y);
System.out.println("Click");
}
else if (e.getKeyCode() == KeyEvent.VK_LEFT)
{
System.out.println("Click");
rect.setLocation(rect.x-2, rect.y);
}
else if (e.getKeyCode() == KeyEvent.VK_UP)
{

rect.setLocation(rect.x, rect.y+2);
}
else if (e.getKeyCode() == KeyEvent.VK_DOWN)
{
rect.setLocation(rect.x, rect.y-2); //
}

repaint();
Previous Topic:How to replace jsp comments with html comments
Next Topic:change the content of debug view in eclipse
Goto Forum:
  


Current Time: Tue Apr 22 14:58:36 EDT 2025

Powered by FUDForum. Page generated in 0.03708 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top