Run the snippet below and put the focus into the TextField and activate the menu using ALT and then type "e" and notice:
- that the character is also showing up in the text-field
- the Edit menu is not opened
I'm marking this as a major bug because it makes mnemonics completely unusable in many applications
package application;
import javafx.application.Application;
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.control.Menu;
import javafx.scene.control.MenuBar;
import javafx.scene.control.MenuItem;
import javafx.scene.control.TextField;
import javafx.scene.layout.BorderPane;
public class Main extends Application {
@Override
public void start(Stage primaryStage) {
try {
BorderPane root = new BorderPane();
MenuBar b = new MenuBar();
{
Menu m = new Menu("_File");
MenuItem i = new MenuItem("Tes_t");
i.setOnAction( e -> System.err.println("Called!!!!"));
m.getItems().add(i);
b.getMenus().add(m);
}
{
Menu m = new Menu("_Edit");
MenuItem i = new MenuItem("Te_st");
m.getItems().add(i);
b.getMenus().add(m);
}
root.setTop(b);
root.setCenter(new TextField());
Scene scene = new Scene(root,400,400);
scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm());
primaryStage.setScene(scene);
primaryStage.show();
} catch(Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
launch(args);
}
}
- that the character is also showing up in the text-field
- the Edit menu is not opened
I'm marking this as a major bug because it makes mnemonics completely unusable in many applications
package application;
import javafx.application.Application;
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.control.Menu;
import javafx.scene.control.MenuBar;
import javafx.scene.control.MenuItem;
import javafx.scene.control.TextField;
import javafx.scene.layout.BorderPane;
public class Main extends Application {
@Override
public void start(Stage primaryStage) {
try {
BorderPane root = new BorderPane();
MenuBar b = new MenuBar();
{
Menu m = new Menu("_File");
MenuItem i = new MenuItem("Tes_t");
i.setOnAction( e -> System.err.println("Called!!!!"));
m.getItems().add(i);
b.getMenus().add(m);
}
{
Menu m = new Menu("_Edit");
MenuItem i = new MenuItem("Te_st");
m.getItems().add(i);
b.getMenus().add(m);
}
root.setTop(b);
root.setCenter(new TextField());
Scene scene = new Scene(root,400,400);
scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm());
primaryStage.setScene(scene);
primaryStage.show();
} catch(Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
launch(args);
}
}
- blocks
-
JDK-8088768 Keyboard traversal of menubar with hidden menu is broken
-
- Open
-
- is blocked by
-
JDK-8139606 [MenuBar] Menus should activate on ALT released, not pressed, on Windows/Linux
-
- Resolved
-