Class PillButtonShaper

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static LazyResettableHashMap<java.awt.Shape> contours
      Cache of already computed contours.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      javax.swing.border.Border getButtonBorder​(javax.swing.AbstractButton button)
      Returns the border for the specified button.
      java.awt.Shape getButtonOutline​(javax.swing.AbstractButton button, float extraInsets, float width, float height, double scaleFactor, boolean isInner)
      Returns the outline path for the specified button.
      float getCornerRadius​(javax.swing.AbstractButton button, float insets)
      Returns the corner radius of the specified button.
      java.lang.String getDisplayName()
      Returns the display name of this trait.
      java.awt.Dimension getPreferredSize​(javax.swing.AbstractButton button, java.awt.Dimension uiPreferredSize)
      Returns the preferred size for the specified button.
      boolean isProportionate()
      Returns the boolean indication whether the shaper should maintain button proportions on the resize.
      static boolean isRoundButton​(javax.swing.AbstractButton button)
      Returns indication whether the specified button should be drawn with completely round corners.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • contours

        private static final LazyResettableHashMap<java.awt.Shape> contours
        Cache of already computed contours.
    • Constructor Detail

      • PillButtonShaper

        public PillButtonShaper()
    • Method Detail

      • getDisplayName

        public java.lang.String getDisplayName()
        Description copied from interface: RadianceTrait
        Returns the display name of this trait. This method is part of officially supported API.
        Specified by:
        getDisplayName in interface RadianceTrait
        Returns:
        The display name of this trait.
      • getButtonOutline

        public java.awt.Shape getButtonOutline​(javax.swing.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 interface RadianceButtonShaper
        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

        public javax.swing.border.Border getButtonBorder​(javax.swing.AbstractButton button)
        Description copied from interface: RadianceButtonShaper
        Returns the border for the specified button.
        Specified by:
        getButtonBorder in interface RadianceButtonShaper
        Parameters:
        button - A button.
        Returns:
        The border for the specified button.
      • getPreferredSize

        public java.awt.Dimension getPreferredSize​(javax.swing.AbstractButton button,
                                                   java.awt.Dimension uiPreferredSize)
        Description copied from interface: RadianceButtonShaper
        Returns the preferred size for the specified button.
        Specified by:
        getPreferredSize in interface RadianceButtonShaper
        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

        public static boolean isRoundButton​(javax.swing.AbstractButton button)
        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 interface RadianceButtonShaper
        Returns:
        true if this shaper should maintain button proportions on the resize, false otherwise.
      • getCornerRadius

        public float getCornerRadius​(javax.swing.AbstractButton button,
                                     float insets)
        Description copied from interface: RectangularButtonShaper
        Returns the corner radius of the specified button.
        Specified by:
        getCornerRadius in interface RectangularButtonShaper
        Parameters:
        button - Button.
        insets - Button insets.
        Returns:
        Corner radius of the specified button.