Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Key Event Question.

 
Michael Hubele
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

When the user clicks on the middle button of there phone I want it to print something out to the screen. This may seem weird but this is just a test to see how it works. Since I am not actually sure how to monitor if that user has click that button or not. I was looking into key events but every example I seen seems to use the game canvus but I am not making a game.

So I am sure where to put my method. Right now I am just starring at a blank form and I would like to to display on this form.

private void keyPressed(int keyCode)
{
System.out.println("keyPressed " + ((char) keyCode));
}

Thanks
 
Aleksandar Babic
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you want to print on the form you can create textfield on the form and call textfield.setString("some string") and then display.setCurrent(form)
or something like that
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!