-Short description-
By running the following code with tooltips in a MacBook Pro with an external Monitor attached, the tooltips are shown not correctly align in one of the screens.
-Steps to reproduce-
1. Run the following code in a Mac with an external monitor(two screens)
import javafx.application.Platform;
import javafx.embed.swing.JFXPanel;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.ComboBox;
import javafx.scene.control.Tooltip;
import javafx.scene.layout.HBox;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
/**
*
* @author diego.cirujano-cuesta
*/
public class JavaFXSwingApplication extends JFrame {
private static void initAndShowGUI() {
JFrame frame = new JFrame("FX");
final JFXPanel fxPanel = new JFXPanel();
frame.add(fxPanel);
frame.setVisible(true);
Platform.runLater(() -> {
Button btn = new Button("Hola mundo");
btn.setTooltip(new Tooltip("hola mundo"));
ComboBox box = new ComboBox();
HBox root = new HBox(btn, box);
Scene scene = new Scene(root);
fxPanel.setScene(scene);
});
}
public static void main(String[] args) {
SwingUtilities.invokeLater(() -> {
initAndShowGUI();
});
}
}
2. Have a look to the tooltip in one of the monitors
3. If it was correctly align, have a look in the other monitor.
-What happened-
The tooltip is shown not correctly align in one of the monitors. Sometimes the combobox popup is also not correctly shown but this is harder to reproduce.
All tooltips and popups are not correctly shown in one of the monitors.
By running the following code with tooltips in a MacBook Pro with an external Monitor attached, the tooltips are shown not correctly align in one of the screens.
-Steps to reproduce-
1. Run the following code in a Mac with an external monitor(two screens)
import javafx.application.Platform;
import javafx.embed.swing.JFXPanel;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.ComboBox;
import javafx.scene.control.Tooltip;
import javafx.scene.layout.HBox;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
/**
*
* @author diego.cirujano-cuesta
*/
public class JavaFXSwingApplication extends JFrame {
private static void initAndShowGUI() {
JFrame frame = new JFrame("FX");
final JFXPanel fxPanel = new JFXPanel();
frame.add(fxPanel);
frame.setVisible(true);
Platform.runLater(() -> {
Button btn = new Button("Hola mundo");
btn.setTooltip(new Tooltip("hola mundo"));
ComboBox box = new ComboBox();
HBox root = new HBox(btn, box);
Scene scene = new Scene(root);
fxPanel.setScene(scene);
});
}
public static void main(String[] args) {
SwingUtilities.invokeLater(() -> {
initAndShowGUI();
});
}
}
2. Have a look to the tooltip in one of the monitors
3. If it was correctly align, have a look in the other monitor.
-What happened-
The tooltip is shown not correctly align in one of the monitors. Sometimes the combobox popup is also not correctly shown but this is harder to reproduce.
All tooltips and popups are not correctly shown in one of the monitors.
- duplicates
-
JDK-8094242 Mac: Screen.getBounds() and Screen.getVisualBounds() return strange values for secondary screens on MacOS
- Resolved