Class PillButtonShaper
java.lang.Object
org.pushingpixels.radiance.theming.api.shaper.PillButtonShaper
- All Implemented Interfaces:
RadianceButtonShaper
,RectangularButtonShaper
,RadianceTrait
public class PillButtonShaper
extends Object
implements RadianceButtonShaper, RectangularButtonShaper
Button shaper that returns buttons with completely rounded corners (ala Mac 10.4). This class is
part of officially supported API.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final LazyResettableHashMap
<Shape> Cache of already computed contours. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetButtonBorder
(AbstractButton button) Returns the border for the specified button.getButtonOutline
(AbstractButton button, float extraInsets, float width, float height, double scaleFactor, boolean isInner) Returns the outline path for the specified button.float
getCornerRadius
(AbstractButton button, float insets) Returns the corner radius of the specified button.Returns the display name ofthis
trait.getPreferredSize
(AbstractButton button, Dimension uiPreferredSize) Returns the preferred size for the specified button.boolean
Returns the boolean indication whether the shaper should maintain button proportions on the resize.static boolean
isRoundButton
(AbstractButton button) Returns indication whether the specified button should be drawn with completely round corners.
-
Field Details
-
contours
Cache of already computed contours.
-
-
Constructor Details
-
PillButtonShaper
public PillButtonShaper()
-
-
Method Details
-
getDisplayName
Description copied from interface:RadianceTrait
Returns the display name ofthis
trait. This method is part of officially supported API.- Specified by:
getDisplayName
in interfaceRadianceTrait
- Returns:
- The display name of
this
trait.
-
getButtonOutline
public Shape getButtonOutline(AbstractButton button, float extraInsets, float width, float height, double scaleFactor, boolean isInner) Description copied from interface:RadianceButtonShaper
Returns the outline path for the specified button.- Specified by:
getButtonOutline
in interfaceRadianceButtonShaper
- Parameters:
button
- A button.extraInsets
- Button insets.width
- Button width.height
- Button height.scaleFactor
- Scale factor.isInner
- Indication whether the returned outline is used for the inner contour.- Returns:
- The outline path for the specified button.
-
getButtonBorder
Description copied from interface:RadianceButtonShaper
Returns the border for the specified button.- Specified by:
getButtonBorder
in interfaceRadianceButtonShaper
- Parameters:
button
- A button.- Returns:
- The border for the specified button.
-
getPreferredSize
Description copied from interface:RadianceButtonShaper
Returns the preferred size for the specified button.- Specified by:
getPreferredSize
in interfaceRadianceButtonShaper
- Parameters:
button
- A button.uiPreferredSize
- Preferred size of the button under the regular conditions (plain rectangular button).- Returns:
- The preferred size for the specified button.
-
isRoundButton
Returns indication whether the specified button should be drawn with completely round corners.- Parameters:
button
- A button.- Returns:
true
if the specified button should be drawn with completely round corners,false
otherwise.
-
isProportionate
public boolean isProportionate()Description copied from interface:RadianceButtonShaper
Returns the boolean indication whether the shaper should maintain button proportions on the resize. This may be relevant for vector-based shapers (such as animals / other objects).- Specified by:
isProportionate
in interfaceRadianceButtonShaper
- Returns:
true
ifthis
shaper should maintain button proportions on the resize,false
otherwise.
-
getCornerRadius
Description copied from interface:RectangularButtonShaper
Returns the corner radius of the specified button.- Specified by:
getCornerRadius
in interfaceRectangularButtonShaper
- Parameters:
button
- Button.insets
- Button insets.- Returns:
- Corner radius of the specified button.
-