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

Windows HiDPI html lightweight tooltips are truncated

    Details

    • Subcomponent:
    • Understanding:
      Cause Known
    • Introduced In Version:
      10
    • CPU:
      x86_64
    • OS:
      windows_10

      Description

      ADDITIONAL SYSTEM INFORMATION :
      Windows 10 with HiDPI display with everything scaled at 200%

      A DESCRIPTION OF THE PROBLEM :
      HTML tooltips aren't big enough to contain their contents on Windows HiDPI displays, so the final word on a line wraps to the next line. If it is a multi-line tooltip, then the final line is missing entirely.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run the attached program. Mouse over the button and wait for the tooltip to appear

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The tooltip says "Some tooltip text"
      ACTUAL -
      The tooltip says "Some tooltip"

      ---------- BEGIN SOURCE ----------
      package com.company;

      import javax.swing.*;
      import java.awt.*;

      public class TruncatedTooltip {

          public static void main(String[] args) {
              // Demonstrate that the tooltip contents are truncated when the tooltip is lightweight (entirely within the window bounds) on Windows HiDPI displays
              try {
                  UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
                  JButton button = new JButton("toggle height");
                  button.setToolTipText("<html>Some tooltip text<html>");
                  JFrame frame = new JFrame();
                  frame.getContentPane().setLayout(new FlowLayout());
                  frame.getContentPane().add(button);
                  frame.setSize(400,200);
                  frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
                  frame.setVisible(true);
                  button.addActionListener(e -> frame.setSize(300,frame.getHeight()<200?200:40));
              } catch (Exception e) {
                  throw new RuntimeException(e);
              }
          }
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Click the button which decreases the size of the window enough such that the tooltip needs to extend outside of the window bounds. It displays correctly as a heavy weight tooltip.

      This bug does not happen under Java 9.

      This bug does not happen if the Windows look and feel is not set.

      FREQUENCY : always


        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                psadhukhan Prasanta Sadhukhan
                Reporter:
                webbuggrp Webbug Group
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated: