LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-18-2005, 01:27 AM   #1
bastin_gh
LQ Newbie
 
Registered: May 2005
Location: Trivandrum
Distribution: Fedora core 3
Posts: 6

Rep: Reputation: 0
Post 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..
 
Old 07-18-2005, 03:55 AM   #2
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
If you want to act on keys being pressed, you need to do this with event handling in Java. This class might be useful.
 
Old 07-18-2005, 04:01 AM   #3
lokesh.ranadive
LQ Newbie
 
Registered: Jul 2005
Posts: 1

Rep: Reputation: 0
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
 
Old 07-19-2005, 02:03 AM   #4
bastin_gh
LQ Newbie
 
Registered: May 2005
Location: Trivandrum
Distribution: Fedora core 3
Posts: 6

Original Poster
Rep: Reputation: 0
yes.. i tried the event handling.. it is working.. have to use the KeyListener Interface for the purpose... thanx for the answer...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Method Not Allowed: The requested method POST is not allowed for the URL /writedhcp.p WiWa Linux - Networking 15 01-06-2011 01:20 PM
A port of Java's Properties in C++ xowl Programming 1 07-26-2005 07:45 AM
C equivalent of Java's isnumeric zaichik Programming 3 02-08-2005 08:06 PM
Help with getch... darkarcon2015 Programming 4 09-12-2004 08:48 AM
java's sockets or python's friendlier to use? Dominik Programming 2 03-06-2004 06:19 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:43 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration