File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes how to link a keyboard to the program... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "how to link a keyboard to the program..." Watch "how to link a keyboard to the program..." New topic
Author

how to link a keyboard to the program...

Mel Oyello
Greenhorn

Joined: May 06, 2004
Posts: 2
hello,
I'm part of an AP comp sci class, and my final project is to find a way to link the keyboard to my program...however, I'm not nearly advanced enough to figure out how to use gui's and swing etc...all i'm dealing with is the dos prompt print up...is there anyway to link the keyboard to what a program does without delving into creating your own gui and mastering swing?
thanx dudes
Stefan Wagner
Ranch Hand

Joined: Jun 02, 2003
Posts: 1923

look at System.in


http://home.arcor.de/hirnstrom/bewerbung
Kush Kush
Greenhorn

Joined: Apr 27, 2004
Posts: 11
You can try out following code to take input from Keyboard:
import java.io.*;
class Input{
public static String getInput(){
String result ="";
try{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
result = br.readLine();
}catch(Exception e){
System.out.println("Error Reading");
}
return (result);
}
}
This is static method on class Input
You can use it as :-
//Your code
String text=Input.getInput();
int i=Integer.parsenInt(Input.getInput());
--- // Your code
[ May 07, 2004: Message edited by: Kush Kush ]

Smile with JAVA
Mel Oyello
Greenhorn

Joined: May 06, 2004
Posts: 2
thanx man, but what does the
"
int i=Integer.parsenInt(Input.getInput());
"
line mean?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to link a keyboard to the program...