swingx
  1. swingx
  2. SWINGX-964

UI delegate installed Painters can hide user background

    Details

    • Issuezilla Id:
      964

      Description

      Per the thread, user specified background colors are hidden if a delegate
      installs a Painter (background Painters paint overtop of the background).

      Possible solution listed in thread, still needs to handle/understand Painter
      opacity.

      Karl

        Issue Links

          Activity

          Hide
          rah003 added a comment -

          Moving all open issues to the next version.

          Show
          rah003 added a comment - Moving all open issues to the next version.
          Hide
          Karl Schaefer added a comment -

          From 978 (blocking issue), Jan wrote:
          I was about to try to solve it the way I described in the thread related to
          swingx-964 - make setting the background color shorthand to setting MattePainter
          with the background color as a background painter and see how it holds in
          reality to validate this approach. Any problem with it?

          The updated swingx package JavaDoc (so far uncommitted) now states:

          • <h3>Painter-enabled components</h3>
          • Components that use painters for background rendering alter the functionality
          • of how {@link java.awt.Component#setBackground(java.awt.Color)}

            works.

          • Setting the background color of a painter-enabled component effectively sets
          • the background painter to paint the requested color.
          • <p>
          • Look and Feel implementors should note that setting a
          • {@link java.swing.plaf.UIResource}

            to

            {@code setBackground}

            will cause a

          • {@code Painter}

            {@code UIResource}

            to be installed. This means that

          • implementors should set the background before setting the painter as the
            last
          • one set wins.

          So, I'm fine with proposed implementation, which is, I believe, what we all
          agreed to in the thread corresponding to this bug.

          Karl

          Show
          Karl Schaefer added a comment - From 978 (blocking issue), Jan wrote: I was about to try to solve it the way I described in the thread related to swingx-964 - make setting the background color shorthand to setting MattePainter with the background color as a background painter and see how it holds in reality to validate this approach. Any problem with it? The updated swingx package JavaDoc (so far uncommitted) now states: <h3>Painter-enabled components</h3> Components that use painters for background rendering alter the functionality of how {@link java.awt.Component#setBackground(java.awt.Color)} works. Setting the background color of a painter-enabled component effectively sets the background painter to paint the requested color. <p> Look and Feel implementors should note that setting a {@link java.swing.plaf.UIResource} to {@code setBackground} will cause a {@code Painter} {@code UIResource} to be installed. This means that implementors should set the background before setting the painter as the last one set wins. So, I'm fine with proposed implementation, which is, I believe, what we all agreed to in the thread corresponding to this bug. Karl
          Hide
          kleopatra added a comment -

          just to leave a trace everywhere: the recent change to JXPanel's
          background/painter handling introduced Issue 983 - hampering our tree
          rendering. While I could "fix" that (by simply using not using a JXPanel
          that's not the way to go: similarly all JXPanel client code out in the wild
          would have to be fixed one way or another. Far too much instability introduced
          so shortly before final.

          So my suggestions:

          • revert whatever was done immediately
          • evaluate if it can be done without requiring a change to existing clients
            (fortunately we have the tree renderer as marker)
          • if not postpone to after final

          Cheers
          Jeanette

          Show
          kleopatra added a comment - just to leave a trace everywhere: the recent change to JXPanel's background/painter handling introduced Issue 983 - hampering our tree rendering. While I could "fix" that (by simply using not using a JXPanel that's not the way to go: similarly all JXPanel client code out in the wild would have to be fixed one way or another. Far too much instability introduced so shortly before final. So my suggestions: revert whatever was done immediately evaluate if it can be done without requiring a change to existing clients (fortunately we have the tree renderer as marker) if not postpone to after final Cheers Jeanette
          Hide
          Karl Schaefer added a comment -

          I hadn't forgotten about the issue. Just thinking about it to see if I could
          come up with a way that I could solve it without breaking client code.

          I can't. Given that even experienced developers "do the wrong thing" and use
          the opaque property as a draw/don't draw background property, I don't want to
          think what inexperienced developers might be doing. I expect this is the same
          problem encountered by Nimbus (there were several blogs about how to not
          display the background). Given that Nimbus is 1.6 and this change has similar
          effects, I now believe that we should not solve this prior to 1.0.

          I will undo the changes today.

          Setting at post 1.0.

          Karl

          Show
          Karl Schaefer added a comment - I hadn't forgotten about the issue. Just thinking about it to see if I could come up with a way that I could solve it without breaking client code. I can't. Given that even experienced developers "do the wrong thing" and use the opaque property as a draw/don't draw background property, I don't want to think what inexperienced developers might be doing. I expect this is the same problem encountered by Nimbus (there were several blogs about how to not display the background). Given that Nimbus is 1.6 and this change has similar effects, I now believe that we should not solve this prior to 1.0. I will undo the changes today. Setting at post 1.0. Karl
          Hide
          Karl Schaefer added a comment -

          Issue 964: Created an package-private interface and Painter to enable easy
          handling of background painting. The algorithm works as defined in the bug,
          but the new Painter respects the opacity of the supplied component, unless the
          current L&F is Nimbus (which always paints the background). This solves Issue
          964 without causing a resurgeance of Issue 983.

          src/java/org/jdesktop/swingx/BackgroundPaintable.java
          src/java/org/jdesktop/swingx/BackgroundPainter.java
          src/java/org/jdesktop/swingx/JXPanel.java
          src/java/org/jdesktop/swingx/SwingXUtilities.java
          src/java/org/jdesktop/swingx/package-info.java
          src/test/org/jdesktop/swingx/JXPanelTest.java

          Committed revision 3713.

          Show
          Karl Schaefer added a comment - Issue 964: Created an package-private interface and Painter to enable easy handling of background painting. The algorithm works as defined in the bug, but the new Painter respects the opacity of the supplied component, unless the current L&F is Nimbus (which always paints the background). This solves Issue 964 without causing a resurgeance of Issue 983. src/java/org/jdesktop/swingx/BackgroundPaintable.java src/java/org/jdesktop/swingx/BackgroundPainter.java src/java/org/jdesktop/swingx/JXPanel.java src/java/org/jdesktop/swingx/SwingXUtilities.java src/java/org/jdesktop/swingx/package-info.java src/test/org/jdesktop/swingx/JXPanelTest.java Committed revision 3713.

            People

            • Assignee:
              Karl Schaefer
              Reporter:
              Karl Schaefer
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: