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

Selected text is shifted on HiDPI display

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P2
    • Resolution: Fixed
    • Affects Version/s: 9
    • Fix Version/s: 9
    • Component/s: client-libs
    • Resolved In Build:
      b143

      Description

      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);
          }
      }
      ----------------------

        Attachments

        1. caret-custom-2x.png
          15 kB
          Alexandr Scherbatiy
        2. caret-default-2x.png
          15 kB
          Alexandr Scherbatiy
        3. caret-default-4x.png
          23 kB
          Alexandr Scherbatiy
        4. CaretFloatingPointAPITest.java
          16 kB
          Alexandr Scherbatiy

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved: