有那位用java写过读取com口的程序(就是银行取钱的时候用密码键盘输入的那种)谢谢!

sandsworlf 2003-10-06 11:14:11
如题!
能够读取密码键盘输入的数据,谢谢!
...全文
50 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
sandsworlf 2003-10-10
  • 打赏
  • 举报
回复
怎么能够让密码键盘能够输入数据,也就是要驱动它,我以前没有用过这个东西,希望哪位老大用过帮帮我,谢谢!
cxyPioneer 2003-10-09
  • 打赏
  • 举报
回复
up
highreport 2003-10-09
  • 打赏
  • 举报
回复
up
zy20001_2001 2003-10-08
  • 打赏
  • 举报
回复
跟着学习一下
iamok 2003-10-08
  • 打赏
  • 举报
回复
推荐jacob
chaojinn 2003-10-08
  • 打赏
  • 举报
回复
首先到http://java.sun.com上下载JCommunication API(JCOMM)包.
里面有相应的例子。很好懂的。
使用时注意设置路径等问题(具体看readme吧,这一点很重要,我用的时候就在这里卡住过)。
okwuzhijun 2003-10-06
  • 打赏
  • 举报
回复
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.lang.NumberFormatException;

public class StandardInputReader extends BufferedReader {

/**
* Constructs a new input stream with the specified standard input stream
*/
public StandardInputReader() {
super(new InputStreamReader(System.in));
}

/**
* Read a boolean value from standard input stream.
*
* @return a boolean value.
* @throws IOException
*/
public boolean readBoolean() throws IOException {
String strBoolean = super.readLine();

if (strBoolean.equalsIgnoreCase("true")) {
return true;
} else if (strBoolean.equalsIgnoreCase("false")) {
return false;
} else {
throw new NumberFormatException("For input string: \""
+ strBoolean +"\"");
}
}

/**
* Read a byte value from standard input stream.
*
* @return a byte value.
* @throws IOException
*/
public byte readByte() throws IOException {
return Byte.parseByte(super.readLine());
}

/**
* Read a short value from standard input stream.
*
* @return a short value.
* @throws IOException
*/
public short readShort() throws IOException {
return Short.parseShort(super.readLine());
}

/**
* Read a int value from standard input stream.
*
* @return a int value.
* @throws IOException
*/
public int readInt() throws IOException {
return Integer.parseInt(super.readLine());
}

/**
* Read a long value from standard input stream.
*
* @return a long value.
* @throws IOException
*/
public long readLong() throws IOException {
return Long.parseLong(super.readLine());
}

/**
* Read a float value from standard input stream.
*
* @return a float value.
* @throws IOException
*/
public float readFloat() throws IOException {
return Float.parseFloat(super.readLine());
}

/**
* Read a double value from standard input stream.
*
* @return a double value.
* @throws IOException
*/
public double readDouble() throws IOException {
return Double.parseDouble(super.readLine());
}
}
tianya2002 2003-10-06
  • 打赏
  • 举报
回复
看不明白,有没有注示呀
fpwang 2003-10-06
  • 打赏
  • 举报
回复
up

62,616

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧