[SWINGX-1516] JXPanel: support _not painting_ background on alpha Created: 08/Aug/12  Updated: 27/Feb/13  Resolved: 14/Nov/12

Status: Resolved
Project: swingx
Component/s: Misc Component
Affects Version/s: 1.6.4
Fix Version/s: 1.6.5

Type: Bug Priority: Critical
Reporter: kleopatra Assignee: Karl Schaefer
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Dependency
blocks SWINGX-1518 JXPanel: umbrella issue for paint pro... Closed
Related
is related to SWINGX-1549 JXPanel: (semi-) transparent backgrou... Open

 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.



 Comments   
Comment by Karl Schaefer [ 08/Aug/12 ]

This likely becomes a duplicate of SWINGX-1514.

Comment by Karl Schaefer [ 13/Nov/12 ]

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.

Comment by Karl Schaefer [ 14/Nov/12 ]

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.

Comment by Karl Schaefer [ 14/Nov/12 ]

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.

Generated at Thu Apr 27 08:34:23 UTC 2017 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.