LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   what is java's corresponding method for c's getch() (https://www.linuxquestions.org/questions/programming-9/what-is-javas-corresponding-method-for-cs-getch-344175/)

bastin_gh 07-18-2005 01:27 AM

what is java's corresponding method for c's getch()
 
hi... i intended to do a game in java.. In that i needed some keyboard controls for making the movements like up, down, left and right using some keys.. But actually, i need something like C's getch() function to take the keyboard strokes... can anyone find out the corresponding method in java or any other construct which helps in doing so..

Nylex 07-18-2005 03:55 AM

If you want to act on keys being pressed, you need to do this with event handling in Java. This class might be useful.

lokesh.ranadive 07-18-2005 04:01 AM

hi,
plz check the following link : http://java.sun.com/j2se/1.4.2/docs/api/
there are a lots of funcyion available in java.io package ,so try whichever suites u.

Urs
Lokesh

bastin_gh 07-19-2005 02:03 AM

yes.. i tried the event handling.. it is working.. have to use the KeyListener Interface for the purpose... thanx for the answer...


All times are GMT -5. The time now is 03:53 AM.