If you look at the following code, visually the text is exactly the same but one of them has a mnemonic. The one with the mnemonic is wider when it should be the same width.
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.FlowPane;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class ButtonWidthTest extends Application {
@Override
public void start(Stage stage) throws Exception {
FlowPane pane = new FlowPane();
Scene scene = new Scene(pane, 500, 500);
stage.setScene(scene);
VBox vBox = new VBox();
Button button1 = new Button("1:Fields");
Button button2 = new Button("_1:Fields");
button2.setMnemonicParsing(true);
vBox.getChildren().addAll(button1, button2);
pane.getChildren().add(vBox);
stage.show();
}
public static void main(String[] args) {
Application.launch(args);
}
}
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.FlowPane;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class ButtonWidthTest extends Application {
@Override
public void start(Stage stage) throws Exception {
FlowPane pane = new FlowPane();
Scene scene = new Scene(pane, 500, 500);
stage.setScene(scene);
VBox vBox = new VBox();
Button button1 = new Button("1:Fields");
Button button2 = new Button("_1:Fields");
button2.setMnemonicParsing(true);
vBox.getChildren().addAll(button1, button2);
pane.getChildren().add(vBox);
stage.show();
}
public static void main(String[] args) {
Application.launch(args);
}
}
- duplicates
-
JDK-8089193 Width of menu is affected by mnemonic-identifier
-
- Resolved
-