作者superlubu (叔叔你人真好)
看板java
标题Re: [问题] 请教 JEditorPane 及 Listener的问题
时间Wed Jun 11 14:45:28 2008
※ 引述《seruze (seruze)》之铭言:
: 这样的我有试过了,我是这样写的
: public void keyTyped( KeyEvent e )
: {
: System.out.println(" 我确定进来了 ");
: if( e.getKeyCode() == KeyEvent.VK_ENTER )
: {
: System.out.println("..orz..");
: jEditorPane.setText("");
: }
: }
: 结果会出输出
: 「我确定来了!」
: 而「orz.」却是完全没反应....
好了... 请看 API 关於 KeyEvent 的说明...
getKeyCode
public int getKeyCode()
Returns the integer keyCode associated with the key in this event.
Returns:
the integer code for an actual key on the keyboard. (
For KEY_TYPED eve
nts, the keyCode is VK_UNDEFINED.)
在 KEY_TYPED event 只能用 getKeyChar
--
《为了要得到真相,就要向原 PO 伸图》
那就是伸图魔人的没图没真相原则,那时我们坚信那就是逼逼死的真实
靠么,图咧?
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 147.8.127.102
※ 编辑: superlubu 来自: 147.8.127.102 (06/11 14:46)
1F:推 TonyQ:其实更极端一点可以自己测进来的Char是多少XD 06/11 14:58