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

Insufficient repaint after JTable header tooltip

    XMLWordPrintable

    Details

    • Subcomponent:
    • Introduced In Version:
      9
    • CPU:
      x86_64
    • OS:
      windows_10

      Description

      ADDITIONAL SYSTEM INFORMATION :
      Seen on Windows 10 and Ubuntu.

      A DESCRIPTION OF THE PROBLEM :
      The table contains blank areas after the tooltip for the table header is hidden.

      REGRESSION : Last worked in version 8u181

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Move mouse to table header
      2. Wait until tooltip is displayed
      3. Wait until tooltip is hidden
      4. See blank areas in the table where the tooltip was

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Repaint of entire area covered by tooltip.
      ACTUAL -
      Unexpected blank areas remain where the tooltip was displayed.
      This happen most of the times, but not always.

      ---------- BEGIN SOURCE ----------
      import javax.swing.*;
      import javax.swing.table.DefaultTableModel;
      import java.awt.*;

      public class TableHeaderToolTipBug {
          private TableHeaderToolTipBug() {
          }

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

          private static void run() {
              Object[][] data = new Object[5][];
              for (int i = 0; i < data.length; i++) {
                  data[i] = new Object[]{11111111, 22222222, 33333333, 44444444, 55555555};
              }
              JTable table = new JTable(new DefaultTableModel(data, new String[]{"1", "2", "3", "4", "5"}));
              table.getTableHeader().setToolTipText("This is a table header tool tip");

              JPanel panel = new JPanel(new BorderLayout());
              panel.add(table.getTableHeader(), BorderLayout.NORTH);
              panel.add(table);

              JPanel anotherPanel = new JPanel(new BorderLayout());
              anotherPanel.add(panel);

              JDialog dialog = new JDialog((Window) null, "Table header tool tip");
              dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
              dialog.add(anotherPanel);
              dialog.setSize(600, 400);
              dialog.setLocationRelativeTo(null);
              dialog.setVisible(true);
          }
      }

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Otherwise trigger a repaint. (For example by resizing the window.)

      FREQUENCY : often


        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:
                Resolved: