[prev in list] [next in list] [prev in thread] [next in thread]
List: openjdk-openjfx-dev
Subject: Windows: Mnemonics Issue
From: Abhinay Agarwal <abhinay_agarwal () live ! com>
Date: 2020-01-30 16:36:36
Message-ID: PS1PR03MB47000D3CB8BAAE566FF47589E7040 () PS1PR03MB4700 ! apcprd03 ! prod ! outlook ! com
[Download RAW message or body]
On Windows, mnemonics is activated when ALT is pressed. This is true for apps made in \
JavaFX.
However I have found the following discrepancy between Windows Native Apps and JavaFX \
apps:
In Windows, pressing any key(not assigned to mnemonics) in combination with ALT \
doesn't de-activates mnemonics. It is automatically deactivated when ALT is released. \
This can be reproduced in Notepad. However in JavaFX, pressing ALT activates \
mnemonics. If any key (not assinged to mnemonics) is pressed while ALT is being \
pressed, it deactivates mnemonics. This can lead to an unwanted state.
This can be tested by the following steps:
1. Open Notepad -> Type ALT + A. Nothing happens. Once ALT is released, mnemonics is \
de-activated on the MenuBar. 2. Run the attached JavaFX sample. Press ALT -> \
mnemonics activated. Press 'ALT + A' -> mnemonics activates and then de-activates. If \
you continue tapping 'A' (with ALT pressed), we can see that mnemonics are activated \
and deactivated. If we leave the mnemonics in activated state and try to enter text \
'F' in textfield, it will show the MenuItem(s) in the 'File' Menu.
Sample
=======
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 MenuBarMnemonics extends Application {
@Override
public void start(Stage primaryStage) {
BorderPane root = new BorderPane();
MenuBar b = new MenuBar();
Menu file = new Menu("_File");
MenuItem fileTest = new MenuItem("Tes_t");
file.getItems().add(fileTest);
b.getMenus().add(file);
Menu edit = new Menu("_Edit");
MenuItem editTest = new MenuItem("Te_st");
edit.getItems().add(editTest);
b.getMenus().add(edit);
root.setTop(b);
root.setCenter(new TextField());
Scene scene = new Scene(root,400,400);
primaryStage.setScene(scene);
primaryStage.show();
}
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic