-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
8u40, 9
-
Mac OS X Mavericks
Run this sample test :
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.MenuButton;
import javafx.scene.control.MenuItem;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyCodeCombination;
import javafx.scene.input.KeyCombination;
import javafx.stage.Stage;
public class TestshortcutZ extends Application{
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage primaryStage) throws Exception {
MenuButton button = new MenuButton("test");
MenuItem item = new MenuItem("test");
item.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
System.out.println("TRIGGERED");
}
});
item.setAccelerator(new KeyCodeCombination(KeyCode.Z, KeyCombination.SHORTCUT_DOWN));
button.getItems().add(item);
Scene scene = new Scene(button);
primaryStage.setScene(scene);
primaryStage.setMinHeight(300);
primaryStage.setMinWidth(100);
primaryStage.show();
}
}
Try to to CMD + Z with a Mac, nothing happened. If you do it with Windows, the command will become "CTRL+Z" and it is working.
I have tested it with 8u20, I don't have the 8u40 right now on my Mac so I need a confirmation for that version.
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.MenuButton;
import javafx.scene.control.MenuItem;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyCodeCombination;
import javafx.scene.input.KeyCombination;
import javafx.stage.Stage;
public class TestshortcutZ extends Application{
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage primaryStage) throws Exception {
MenuButton button = new MenuButton("test");
MenuItem item = new MenuItem("test");
item.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
System.out.println("TRIGGERED");
}
});
item.setAccelerator(new KeyCodeCombination(KeyCode.Z, KeyCombination.SHORTCUT_DOWN));
button.getItems().add(item);
Scene scene = new Scene(button);
primaryStage.setScene(scene);
primaryStage.setMinHeight(300);
primaryStage.setMinWidth(100);
primaryStage.show();
}
}
Try to to CMD + Z with a Mac, nothing happened. If you do it with Windows, the command will become "CTRL+Z" and it is working.
I have tested it with 8u20, I don't have the 8u40 right now on my Mac so I need a confirmation for that version.
- duplicates
-
JDK-8150709 Mac OSX and German Keyboard Layout (Y/Z)
- Resolved