FULL PRODUCT VERSION :
java version "1.8.0_161"
Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 10.0.16299.248]
A DESCRIPTION OF THE PROBLEM :
The menus from a MenuBar are offset in some conditions on systems with high res screens.
I have a system that has 2 identical 4k screens attached, both with 200% scaling. The left screen is screen 2, the right screen is screen 1.
When an application with a MenuBar is touching the left edge of screen 1, the first menu in the menubar will be offset to the middle of the screen when opened. All other menus are fine.
When the application is on screen 2, all the menus are misaligned when opened.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the attached demo
Move the application to the left edge of screen 1
Try the menus
Move the application to the other screen
Try the menus
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The menus open directly below the menubar item
ACTUAL -
The menus open way over to the right
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Menu;
import javafx.scene.control.MenuBar;
import javafx.scene.control.MenuItem;
import javafx.scene.layout.BorderPane;
import javafx.stage.Stage;
public class MainWindow extends Application
{
public static void main(
String[] args)
{
launch(args);
}
@Override
public void start(
Stage primaryStage) throws Exception
{
final Menu fileMenu = new Menu("File");
fileMenu.getItems().addAll(
createItem("Open"),
createItem("Save"));
final Menu editMenu = new Menu("Edit");
editMenu.getItems().addAll(
createItem("Copy"),
createItem("Paste"));
final BorderPane root = new BorderPane();
root.setTop(new MenuBar(fileMenu, editMenu));
primaryStage.setScene(new Scene(root, 600, 400));
primaryStage.show();
}
private MenuItem createItem(
final String name)
{
final MenuItem item = new MenuItem(name);
item.setOnAction(e -> System.out.println("User clicked " + name));
return item;
}
}
---------- END SOURCE ----------
java version "1.8.0_161"
Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 10.0.16299.248]
A DESCRIPTION OF THE PROBLEM :
The menus from a MenuBar are offset in some conditions on systems with high res screens.
I have a system that has 2 identical 4k screens attached, both with 200% scaling. The left screen is screen 2, the right screen is screen 1.
When an application with a MenuBar is touching the left edge of screen 1, the first menu in the menubar will be offset to the middle of the screen when opened. All other menus are fine.
When the application is on screen 2, all the menus are misaligned when opened.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the attached demo
Move the application to the left edge of screen 1
Try the menus
Move the application to the other screen
Try the menus
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The menus open directly below the menubar item
ACTUAL -
The menus open way over to the right
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Menu;
import javafx.scene.control.MenuBar;
import javafx.scene.control.MenuItem;
import javafx.scene.layout.BorderPane;
import javafx.stage.Stage;
public class MainWindow extends Application
{
public static void main(
String[] args)
{
launch(args);
}
@Override
public void start(
Stage primaryStage) throws Exception
{
final Menu fileMenu = new Menu("File");
fileMenu.getItems().addAll(
createItem("Open"),
createItem("Save"));
final Menu editMenu = new Menu("Edit");
editMenu.getItems().addAll(
createItem("Copy"),
createItem("Paste"));
final BorderPane root = new BorderPane();
root.setTop(new MenuBar(fileMenu, editMenu));
primaryStage.setScene(new Scene(root, 600, 400));
primaryStage.show();
}
private MenuItem createItem(
final String name)
{
final MenuItem item = new MenuItem(name);
item.setOnAction(e -> System.out.println("User clicked " + name));
return item;
}
}
---------- END SOURCE ----------
- duplicates
-
JDK-8160073 menu issues in case of two-display configuration
- Resolved
- relates to
-
JDK-8247839 Wrong position of GUI elements using multiple HiDPI displays in JavaFX 8
- Resolved
-
JDK-8251862 Wrong position of Popup windows at the intersection of 2 screens
- Resolved
-
JDK-8214207 JavaFX menu shows up in the wrong location when GUI spans HiDPI and non-HiDPI
- Closed