Details

    • Type: Sub-task Sub-task
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: 1.6.6
    • Component/s: Misc Component
    • Labels:
      None

      Description

      Core swing (and currently swingx neither) does not support semi-transparent background colors - due to the well-known opacity catch-22:

      • the background is filled only if isOpaque (note: the getter)
      • reporting isOpaque for not fully opaque colors is illegal, doing so will produce the artefacts

      The usual workaround is to set opacity to false and subclass JPanel to take over the background filling before calling super. As JXPanel already takes over much of the background painting (filling and painter), we should support it.

      There are two sides of the coin:

      • complying to opacity contract, that is to automatically adjust the opacy to false if the background color is semi-transparent
      • detect and respect the developer's intention whether or not the background should be filled (independent on it's transparency)

      We have an old issue (marked as fixed, though I disagree a bit) for the second part in SWINGX-1516.

      // first part:
      // set semitransparent background and be done
      panel.setBackground(PaintUtils.setAlpha(Color.RED, 100); 
      // second part: set opacity to relay the intention of filling the 
      // background or not
      // true: fill background - panel getter takes care of complying to contract
      panel.setOpaque(true);
      // false: don't fill the background, independent on container alpha or 
      // background color
      panel.setOpaque(false);
      

      Screenshots of the three-panel example - it's under version control, so can be seen in locally on checkout, in localPath/www/api-reviews/... The screenshots are produced by running JXPanelVisualCheck.backgroundAlphaToggleOpaque with the ui property "JXPanel.patch"
      set to Boolean.TRUE.

      to be continued ...

        Issue Links

          Activity

          Hide
          kleopatra added a comment -

          part of the issue was already adressed (though not really solved) - setting opacity and container/background transparency are orthogonal, the mix'in is an implementation artefact (IMO, might be missing something

          Show
          kleopatra added a comment - part of the issue was already adressed (though not really solved) - setting opacity and container/background transparency are orthogonal, the mix'in is an implementation artefact (IMO, might be missing something

            People

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

              Dates

              • Created:
                Updated: