Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8156217

Selected text is shifted on HiDPI display

XMLWordPrintable

    • b143

      Steps to reproduce:
      - Run the code below on HiDPI display on Windows
      - Select the text from the end to the beginning

      The selected text is shifted than the original one.
      ----------------------
      import java.awt.BorderLayout;
      import javax.swing.JFrame;
      import javax.swing.JPanel;
      import javax.swing.JTextField;
      import javax.swing.SwingUtilities;

      public class CheckTextSelection {

          private static final String TEXT = "aaaaaaaaaaaaaaaaaaaa";

          public static void main(String[] args) {
              SwingUtilities.invokeLater(CheckTextSelection::createAndShowGUI);
          }

          private static void createAndShowGUI() {
              JFrame frame = new JFrame();
              frame.setSize(300, 300);
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

              JPanel panel = new JPanel(new BorderLayout());

              JTextField textField = new JTextField(TEXT);
              panel.add(textField);

              frame.getContentPane().add(panel);
              frame.setVisible(true);
          }
      }
      ----------------------

            alexsch Alexandr Scherbatiy
            alexsch Alexandr Scherbatiy
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: