swingx
  1. swingx
  2. SWINGX-1448

AlphaPaintable.setAlpha should throw IllegalArgumentException for invalid values

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.6.2
    • Fix Version/s: 1.6.3
    • Component/s: Misc Component
    • Labels:
      None

      Description

      We only want values 0f-1f inclusive. Like java.awt.Color, we should throw an IllegalArgumentException when the value is invalid.

        Activity

        Hide
        Karl Schaefer added a comment -

        SWINGX-1400, SWINGX-1401, SWINGX-1447, SWINGX-1448: A variety of small fixes for JXPanel. Firstly, simplify the enumeration for scrollable hinting. This prevent the users from having to special-case vertical and horizontal activities, we handle it under the covers. Fix the tracking of preferred size to check the max size, so we don't stretch a component too far. Improve the clarity of the setAlpha method and throw a runtime exception when the user is doing something untoward. This behavior parallels java.awt.Color, so the user should be accustomed to clamping alpha values correctly. Finally, getEffectiveAlpha was incorrectly tracersing the entire component hierarchy, looking for the ancestor with the lowest alpha, but this methodology did not take alpha inheritance into consideration.

        swingx-core/src/main/java/org/jdesktop/swingx/AlphaPaintable.java
        swingx-core/src/main/java/org/jdesktop/swingx/JXPanel.java
        swingx-core/src/main/java/org/jdesktop/swingx/ScrollableSizeHint.java
        swingx-core/src/test/java/org/jdesktop/swingx/JXPanelTest.java

        Committed revision 4022.

        Show
        Karl Schaefer added a comment - SWINGX-1400 , SWINGX-1401 , SWINGX-1447 , SWINGX-1448 : A variety of small fixes for JXPanel. Firstly, simplify the enumeration for scrollable hinting. This prevent the users from having to special-case vertical and horizontal activities, we handle it under the covers. Fix the tracking of preferred size to check the max size, so we don't stretch a component too far. Improve the clarity of the setAlpha method and throw a runtime exception when the user is doing something untoward. This behavior parallels java.awt.Color, so the user should be accustomed to clamping alpha values correctly. Finally, getEffectiveAlpha was incorrectly tracersing the entire component hierarchy, looking for the ancestor with the lowest alpha, but this methodology did not take alpha inheritance into consideration. swingx-core/src/main/java/org/jdesktop/swingx/AlphaPaintable.java swingx-core/src/main/java/org/jdesktop/swingx/JXPanel.java swingx-core/src/main/java/org/jdesktop/swingx/ScrollableSizeHint.java swingx-core/src/test/java/org/jdesktop/swingx/JXPanelTest.java Committed revision 4022.

          People

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

            Dates

            • Created:
              Updated:
              Resolved: