|
Duplicate :
|
|
|
Duplicate :
|
|
|
Relates :
|
IME candidate window is positioned incorrectly on HiDPI display.
To reproduce:
- Add (e.g.) Japanese locale, switch to IME mode.
- Run the testcase below on a display with a scale factor > 1, or scale it manually -Dsun.java2d.uiScale=<scale>.
- Type into a) frame b) window
The IME window appears in a) unscaled coordinates, b) relative to the frame, not window.
----------------------------
import javax.swing.*;
import java.awt.*;
public class scratch_7 {
public static void main(String[] args) {
EventQueue.invokeLater(scratch_7::run);
}
static void run() {
JFrame frame = new JFrame("owner");
JTextField text1 = new JTextField("type some hiragana here");
frame.add(text1);
frame.pack();
frame.setLocation(200, 200);
frame.setVisible(true);
JWindow window = new JWindow(frame);
JTextField text2 = new JTextField("type some hiragana here");
window.add(text2);
window.pack();
window.setLocationRelativeTo(null);
window.setVisible(true);
}
}
|