I have a button that you can click that will do certain things, now I want the same actions however also when the enter button is pressed on the button(using the tab keys to get there and the enter key to press). This is essentially to create mouse free use. Below is the code for the button click. This Java in BlueJK and the scene is in scene builder however I am not using any code inside of scene builder. If someone could give me a lot of guidance and help that would be greatly appreciated.
@FXML void newuserbackbuttonClicked()
{
FXMLLoader loader = new FXMLLoader(Application.class.getResource("MainScene.fxml"));
try
{
Stage stage2 = new Stage();
stage2.setTitle("Main Scene");
stage2.setScene(new Scene(loader.load()));
stage2.show();
MainScene controller2 = loader.getController();
controller2.prepareStageEvents(stage2);
}
catch (Exception ex)
{
System.out.println(ex.getMessage());
}
stage.close();
}