The problem is:
I use the same code on Eclipse and JBuilder. Eclispse will terminate the
user input if the user types in "CTRL-z". But JBuilder can not terminate the
user input.
The question is:
How can I stop user input from keyboard in JBuilder, using the codes I
described?
Thanks,
JBuilder doesn't appear to pass on control characters sent to its
graphical output window. If you're using full lines of text and all lines
are guaranteed to contain at least some data, then you might want to
rewrite it in a fashion similar to this using a BufferedReader:
package keyboardinput;
import java.io.*;
public class Whatever {
public static void main(String[] args) {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
try {
String line;
while ((line = br.readLine()).length() != 0) {
System.out.println("Got " + line);
}
}
catch (IOException ex) {
ex.printStackTrace();
}
}
}
--
Kevin Dean [TeamB]
Dolphin Data Development Ltd.
http://www.datadevelopment.com/
NEW WHITEPAPERS
Team Development with JBuilder and Borland Enterprise Server
Securing Borland Enterprise Server
http://www.datadevelopment.com/papers/index.html
Please see Borland's newsgroup guidelines at
http://info.borland.com/newsgroups/guide.html
"Kevin Dean [TeamB]" <NkOdS...@datadevelopment.com> 写入消息新闻:xn0e9atwk6i...@www.teamb.com...