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

SynthTextPaneUI.installUI() doesn't set component to opaque even if prop was not set by client progr

XMLWordPrintable

    • b97
    • generic
    • generic

      Method SynthTextPaneUI.installUI(JComponent c) says:

       "... Sets the associated component to opaque
        if the opaque property has not already been set
        by the client program. ..."

      Actually it doesn't happen.
      Please see the following code sample:

      ---
      import javax.swing.*;
      import javax.swing.plaf.synth.*;

      public class InstallUIComponentOpaque {

          public static void main(String[] args) {
              SwingUtilities.invokeLater(new Runnable() {
                  @Override public void run() {
                      try {
                          UIManager.setLookAndFeel(new SynthLookAndFeel());
                      } catch (UnsupportedLookAndFeelException e) {
                          throw new RuntimeException(e);
                      }
                      new JTextPane().setUI(new SynthTextPaneUI() {
                          @Override public void installUI(JComponent c) {
                              System.out.println("c.isOpaque() = " + c.isOpaque());
                              super.installUI(c);
                              System.out.println("InstallUIComponentOpaque.installUI called");
                              System.out.println("c.isOpaque() = " + c.isOpaque());
                          }
                      });
                  }
              });
          }
      }
      ---

      For JDK7 b93 output will be:

      c.isOpaque() = false
      InstallUIComponentOpaque.installUI called
      c.isOpaque() = false
      For JDK7 b98 the output is still

      c.isOpaque() = false
      InstallUIComponentOpaque.installUI called
      c.isOpaque() = false

            peterz Peter Zhelezniakov
            dbessono Dmitry Bessonov
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: