swingx
  1. swingx
  2. SWINGX-1516

JXPanel: support _not painting_ background on alpha

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 1.6.4
    • Fix Version/s: 1.6.5
    • Component/s: Misc Component
    • Labels:
      None

      Description

      after setting the background to a semi-transparent color it's not possible to turn-off background painting completely: toggling the opaque property has no effect. See JXPanelVisualCheck.backgroundAlphaToggleOpaque.

      I think it's necessary to allow configuring option to not paint the background (formerly: setting opaque to false). Maybe need another property, either for internal or external usage to differentiate the dont-paint from paint-non-opaque.

        Issue Links

          Activity

          Hide
          Karl Schaefer added a comment -

          This likely becomes a duplicate of SWINGX-1514.

          Show
          Karl Schaefer added a comment - This likely becomes a duplicate of SWINGX-1514 .
          Hide
          Karl Schaefer added a comment -

          Firstly, this issue is conflating the alpha painting of a color with the alpha painting of the JXPanel. The test in question does not actual test JXPanel's alpha value as it only sets the alpha on the background color.

          Furthermore, I have updated (but not yet committed) a version of the test that places a JPanel and JXPanel side-by-side. They exhibit the same behavior. The problem, it seems, is a core bug where the opacity change does not kick off a repaint.

          Adding a repaint in the action for both panels, clears this issue.

          However, there seems to be a core bug with alpha-enabled colors repainting incorrectly. I am getting visual artifacts that do not appear when I set the background color to Color.RED. I am guessing that the RepaintManager is not reusing the backbuffer correctly for the alpha-colors on opaque components.

          Show
          Karl Schaefer added a comment - Firstly, this issue is conflating the alpha painting of a color with the alpha painting of the JXPanel. The test in question does not actual test JXPanel's alpha value as it only sets the alpha on the background color. Furthermore, I have updated (but not yet committed) a version of the test that places a JPanel and JXPanel side-by-side. They exhibit the same behavior. The problem, it seems, is a core bug where the opacity change does not kick off a repaint. Adding a repaint in the action for both panels, clears this issue. However, there seems to be a core bug with alpha-enabled colors repainting incorrectly. I am getting visual artifacts that do not appear when I set the background color to Color.RED. I am guessing that the RepaintManager is not reusing the backbuffer correctly for the alpha-colors on opaque components.
          Hide
          Karl Schaefer added a comment - - edited

          I have update JXPanelVisualCheck.interactiveBackgroundAlphaToggleOpaque() to display threes panels:

          JPanel red with alpha JXPanel red with alpha JXPanel internal alpha, solid red

          When the panels are non-opaque, the first two show no background, while the last one shows a semi-tranparent red fill.

          When the panels are opaque, there are rendering artifacts in all panels (core issue).

          I think we need to ensure that when a user changes JXPanel from non-opaque to opaque that we reset the alpha value to 1f. I really think that users should either use opacity or alpha on JXPanel, but not both.

          Show
          Karl Schaefer added a comment - - edited I have update JXPanelVisualCheck.interactiveBackgroundAlphaToggleOpaque() to display threes panels: JPanel red with alpha JXPanel red with alpha JXPanel internal alpha, solid red When the panels are non-opaque, the first two show no background, while the last one shows a semi-tranparent red fill. When the panels are opaque, there are rendering artifacts in all panels (core issue). I think we need to ensure that when a user changes JXPanel from non-opaque to opaque that we reset the alpha value to 1f. I really think that users should either use opacity or alpha on JXPanel, but not both.
          Hide
          Karl Schaefer added a comment -

          SWINGX-1516: Altered the documentation to make it clear that using both opacity and alpha is a bad idea. Attempt to help out users, who in spite of the warning, mix the two by tracking the old alpha value when the opacity changes.

          swingx-core/src/main/java/org/jdesktop/swingx/JXPanel.java

          Committed revision 4256.

          Show
          Karl Schaefer added a comment - SWINGX-1516 : Altered the documentation to make it clear that using both opacity and alpha is a bad idea. Attempt to help out users, who in spite of the warning, mix the two by tracking the old alpha value when the opacity changes. swingx-core/src/main/java/org/jdesktop/swingx/JXPanel.java Committed revision 4256.

            People

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

              Dates

              • Created:
                Updated:
                Resolved: