-
Bug
-
Resolution: Duplicate
-
P2
-
9, 10, 11, 12, 13, 14
-
x86_64
-
windows_10
ADDITIONAL SYSTEM INFORMATION :
JDK 11.0.3 on a Windows 1Ã 64 bit system
Two monitors, main monitor standard, left of it same monitor but scaled by 125%
A DESCRIPTION OF THE PROBLEM :
The very first time a Jpopupmenu is shown on a second monitor which is scaled, the popup is shown at the wrong position.
When I show the popup the second time it shows correct.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
run the program and move the window to the scaled monitor.
Click the button and it shows a popup at the clickpoint
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Popup shows where i clicked
ACTUAL -
Popup shows on wrong location +x, -y
---------- BEGIN SOURCE ----------
package com.itzmedi.viewer.viewing;
import java.awt.FlowLayout;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPopupMenu;
public class TestGD implements MouseListener {
private JPopupMenu popup = null;
public static void main(String[] args) {
new TestGD().go();
}
private void go() {
JButton btn = new JButton("click");
btn.addMouseListener(this);
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setLayout(new FlowLayout());
frame.add(btn);
frame.setSize(300,100);
frame.setVisible(true);
}
@Override
public void mousePressed(MouseEvent e) {
popup = new JPopupMenu();
popup.add(new JLabel("Lorem"));
popup.add(new JLabel("ipsum"));
popup.add(new JLabel("dolor"));
popup.add(new JLabel("sit"));
popup.show((JButton)e.getSource(), e.getPoint().x, e.getPoint().y);
}
@Override
public void mouseReleased(MouseEvent e) {
if (popup != null) {
popup.setVisible(false);
}
}
@Override public void mouseEntered(MouseEvent e) { }
@Override public void mouseExited(MouseEvent e) { }
@Override public void mouseClicked(MouseEvent e) { }
}
---------- END SOURCE ----------
FREQUENCY : always
JDK 11.0.3 on a Windows 1Ã 64 bit system
Two monitors, main monitor standard, left of it same monitor but scaled by 125%
A DESCRIPTION OF THE PROBLEM :
The very first time a Jpopupmenu is shown on a second monitor which is scaled, the popup is shown at the wrong position.
When I show the popup the second time it shows correct.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
run the program and move the window to the scaled monitor.
Click the button and it shows a popup at the clickpoint
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Popup shows where i clicked
ACTUAL -
Popup shows on wrong location +x, -y
---------- BEGIN SOURCE ----------
package com.itzmedi.viewer.viewing;
import java.awt.FlowLayout;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPopupMenu;
public class TestGD implements MouseListener {
private JPopupMenu popup = null;
public static void main(String[] args) {
new TestGD().go();
}
private void go() {
JButton btn = new JButton("click");
btn.addMouseListener(this);
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setLayout(new FlowLayout());
frame.add(btn);
frame.setSize(300,100);
frame.setVisible(true);
}
@Override
public void mousePressed(MouseEvent e) {
popup = new JPopupMenu();
popup.add(new JLabel("Lorem"));
popup.add(new JLabel("ipsum"));
popup.add(new JLabel("dolor"));
popup.add(new JLabel("sit"));
popup.show((JButton)e.getSource(), e.getPoint().x, e.getPoint().y);
}
@Override
public void mouseReleased(MouseEvent e) {
if (popup != null) {
popup.setVisible(false);
}
}
@Override public void mouseEntered(MouseEvent e) { }
@Override public void mouseExited(MouseEvent e) { }
@Override public void mouseClicked(MouseEvent e) { }
}
---------- END SOURCE ----------
FREQUENCY : always
- duplicates
-
JDK-8224608 Swing heavyweight popup is displayed incorrectly with the dual monitor setup
- Closed