Re: [問題] 請教 JEditorPane 及 Listener的問題

看板java作者 (叔叔你人真好)時間17年前 (2008/06/11 14:45), 編輯推噓1(100)
留言1則, 1人參與, 最新討論串4/5 (看更多)
※ 引述《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
其實更極端一點可以自己測進來的Char是多少XD
06/11 14:58, 1F
文章代碼(AID): #18JtIBIj (java)
討論串 (同標題文章)
文章代碼(AID): #18JtIBIj (java)