看板 java 關於我們 聯絡資訊
※ 引述《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)
TonyQ:其實更極端一點可以自己測進來的Char是多少XD 06/11 14:58