2014-02-19 66 views

回答

1

剛剛嘗試installEventHandlerpublic void initFX(JFXPanel fxPanel)下創建,它會爲你

public void initFX(JFXPanel fxPanel) { 
//............. 
//............. your code 
installEventHandler(scene); 
} 

然後進入installEventHandler(final Scene keyNode)方法

final EventHandler<javafx.scene.input.KeyEvent> keyEventHandler = new EventHandler<javafx.scene.input.KeyEvent>() { 
     public void handle(final javafx.scene.input.KeyEvent keyEvent) { 
     if (keyEvent.getCode() == KeyCode.ENTER) { 
    //do nothing 
    } 
    if (keyEvent.getCode() == KeyCode.TAB) { 
    //Do nothing 
    } 
} 
+0

什麼是installEventHandler工作? –

+1

謝謝,但相反「//不要偷」是需要改變action.consume –

+0

海關方法來處理您的事件... @比伊 –