Re: [問題] 請教 JEditorPane 及 Listener的問題
※ 引述《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)
推
06/11 14:58, , 1F
06/11 14:58, 1F
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 4 之 5 篇):