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

Nimbus tooltips on disabled components have no border, and wrong background colo

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Duplicate
    • Affects Version/s: 6u10
    • Fix Version/s: 10
    • Component/s: client-libs

      Description

      FULL PRODUCT VERSION :
      java version "1.6.0_11"
      Java(TM) SE Runtime Environment (build 1.6.0_11-b03)
      Java HotSpot(TM) Client VM (build 11.0-b16, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 6.0.6001]

      A DESCRIPTION OF THE PROBLEM :
      With Nimbus LAF, tooltips have a yellow background and black border.

        Tooltips for disabled components, however, have no border, and the background color matches the background color of the panel. So all you see is the tooltip's label floating on the panel, which looks really bad.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Just create a panel with one enabled JButton, and a second disabled JButton. The tooltip works for the enabled button, but you see the "grey box" tooltip with no border on the second button.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Both tooltips should look the same. If you prefer a different disabled background color, that's fine also, but at least include a border around tooltips for disabled components.
      ACTUAL -
      Grey, borderless tips.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      public class TooltipBug extends JFrame {
          public static void main(String[] args) {
              SwingUtilities.invokeLater(new Runnable() {
                  public void run() {
                      try {
                          UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
                      } catch (Exception e) {
                          e.printStackTrace();
                      }
                      new TooltipBug().setVisible(true);
                  }
              });
          }

          public TooltipBug() {
              // un-comment these lines for the workaround
              //UIManager.put("ToolTip[Disabled].backgroundPainter",
              // UIManager.get("ToolTip[Enabled].backgroundPainter"));


              JButton b1 = new JButton("One");
              b1.setToolTipText("Button 1");

              JButton b2 = new JButton("One");
              b2.setEnabled(false);
              b2.setToolTipText("Button 2");

              Container c = getContentPane();
              c.setLayout(new FlowLayout());
              c.add(b1);
              c.add(b2);

              pack();
              setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          }
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      UIManager.put("ToolTip[Disabled].backgroundPainter",
            UIManager.get("ToolTip[Enabled].backgroundPainter"));

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              sveerabhadra Shashidhara Veerabhadraiah (Inactive)
              Reporter:
              igor Igor Nekrestyanov (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: