Mnemonics is "sticking" on with ALT key presses on Windows 7.
Simple example:
import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.Menu;
import javafx.scene.control.MenuBar;
import javafx.scene.control.MenuItem;
import javafx.stage.Stage;
public class MenuBug extends Application
{
public static void main(String[] args)
{
launch(args);
}
@Override
public void start(final Stage primaryStage)
{
primaryStage.setTitle("bug");
Group root = new Group();
MenuBar mb = new MenuBar();
Menu file = new Menu("_File");
MenuItem foo = new MenuItem("foo");
file.setMnemonicParsing(true);
file.getItems().add(foo);
mb.getMenus().add(file);
root.getChildren().add(mb);
mb.prefWidthProperty().bind(primaryStage.widthProperty());
primaryStage.setScene(new Scene(root, 200, 200));
primaryStage.show();
}
}
On Windows 7, if you press and hold the ALT key, the mnemonic underlines appear, as you would expect. When you release the ALT key - it does not disappear. The next time you press the letter F, (without the ALT key being down) the file menu appears.
I cannot reproduce this behavior on Linux - it works as expected there.
I've tested this on Linux (64 bit) - doesn't happen. Windows XP - 32 bit - doesn't happen.
Windows 7 - 64 bit - happens.
All with the 1.7.0_17 java release.
Simple example:
import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.Menu;
import javafx.scene.control.MenuBar;
import javafx.scene.control.MenuItem;
import javafx.stage.Stage;
public class MenuBug extends Application
{
public static void main(String[] args)
{
launch(args);
}
@Override
public void start(final Stage primaryStage)
{
primaryStage.setTitle("bug");
Group root = new Group();
MenuBar mb = new MenuBar();
Menu file = new Menu("_File");
MenuItem foo = new MenuItem("foo");
file.setMnemonicParsing(true);
file.getItems().add(foo);
mb.getMenus().add(file);
root.getChildren().add(mb);
mb.prefWidthProperty().bind(primaryStage.widthProperty());
primaryStage.setScene(new Scene(root, 200, 200));
primaryStage.show();
}
}
On Windows 7, if you press and hold the ALT key, the mnemonic underlines appear, as you would expect. When you release the ALT key - it does not disappear. The next time you press the letter F, (without the ALT key being down) the file menu appears.
I cannot reproduce this behavior on Linux - it works as expected there.
I've tested this on Linux (64 bit) - doesn't happen. Windows XP - 32 bit - doesn't happen.
Windows 7 - 64 bit - happens.
All with the 1.7.0_17 java release.
- relates to
-
JDK-8090647 Mnemonics : on windows we should cancel the underscore latch when an app loses focus.
- Resolved