Class RadianceSizeUtils
- java.lang.Object
-
- org.pushingpixels.radiance.theming.internal.utils.RadianceSizeUtils
-
public class RadianceSizeUtils extends java.lang.ObjectThis class is responsible for computing DPI-aware insets, stroke widths, paddings, icon sizes etc. This class is for internal use only.
-
-
Field Summary
Fields Modifier and Type Field Description private static intcontrolFontSizeCached control font size.
-
Constructor Summary
Constructors Constructor Description RadianceSizeUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static floatgetAdjustedSize(int fontSize, float baseSize, int forEachBase, float toAdjustBy)Gets the adjusted size.static intgetAdjustedSize(int fontSize, int baseSize, int forEachBase, int toAdjustBy, boolean toRoundAsEven)Gets the adjusted size.static floatgetArrowIconHeight(int fontSize)Returns the height of arrow icons under the specified font size.static floatgetArrowIconWidth(int fontSize)Returns the width of arrow icons under the specified font size.static floatgetArrowStrokeWidth(int fontSize)Returns the stroke width of arrow icons under the specified font size.static intgetBigDragBumpDiameter(int fontSize)Returns the diameter of a big drag bump dot under the specified font size.static floatgetBorderStrokeWidth(java.awt.Component c)Returns the stroke width of borders.static java.awt.InsetsgetButtonInsets(java.awt.Component c, int fontSize)Returns the button insets under the specified font size.static javax.swing.border.BordergetCheckBoxBorder(int fontSize, boolean ltr)Returns the border for check boxes under the specified font size.static intgetCheckBoxMarkSize(int fontSize)Returns the check mark size for check boxes under the specified font size.static floatgetClassicButtonCornerRadius(int fontSize)Returns the corner radius forClassicButtonShaperunder the specified font size.static floatgetCloseIconStrokeWidth(int fontSize)Returns the stroke width of close icon under the specified font size.static java.awt.InsetsgetComboBorderInsets(int fontSize)Returns the combo box border insets under the specified font size.static java.awt.InsetsgetComboLayoutInsets(int fontSize)Returns the combo box border insets under the specified font size.static java.awt.InsetsgetComboTextBorderInsets(int fontSize)Returns the combo box text border insets under the specified font size.static intgetComponentFontSize(java.awt.Component c)Computes the font size for the specified component.static intgetControlFontSize()Gets the current control font size.static java.awt.InsetsgetDefaultBorderInsets(int fontSize)Returns the default border insets under the specified font size.static floatgetDoubleArrowStrokeWidth(int fontSize)Returns the stroke width of double arrow icons under the specified font size.static intgetDragBumpDiameter(int fontSize)Returns the diameter of a drag bump dot under the specified font size.static intgetExtraPadding(int fontSize)Returns the extra padding amount under the specified font size.static floatgetFocusRingPadding(java.awt.Component c, int fontSize)Returns the focus ring padding amount under the specified font size.static floatgetFocusStrokeWidth(java.awt.Component c)Returns the stroke width of focus rings.static java.awt.InsetsgetListCellRendererInsets(java.awt.Component c, int fontSize)Returns the list cell renderer insets under the specified font size.static intgetLookupButtonSize()Returns the size of the lookup button.static intgetMenuCheckMarkSize(int fontSize)Returns the check mark size of check box menu items and radio button menu items under the specified font size.static intgetMenuItemMargin(int fontSize)Returns the margin for menu items under the specified font size.static intgetMinButtonWidth(int fontSize)Returns the maximum button height under the specified font size.static intgetPasswordDotDiameter(int fontSize)Returns the password dot diameter for password fields under the specified font size.static intgetPasswordDotGap(int fontSize)Returns the password dot gap for password fields under the specified font size.static javax.swing.border.BordergetRadioButtonBorder(int fontSize, boolean ltr)Returns the border for radio buttons under the specified font size.static intgetRadioButtonMarkSize(int fontSize)Returns the check mark size for radio buttons under the specified font size.static intgetScrollBarWidth(int fontSize)Returns the width of scroll bars under the specified font size.static intgetSliderIconSize(int fontSize)Returns the slider thumb icon size under the specified font size.static intgetSliderTickSize(int fontSize)Returns the slider tick size under the specified font size.static intgetSliderTrackSize(int fontSize)Returns the slider track size under the specified font size.static floatgetSmallArrowIconHeight(int fontSize)Returns the height of small arrow icons under the specified font size.static floatgetSmallArrowIconWidth(int fontSize)Returns the width of small arrow icons under the specified font size.static floatgetSmallDoubleArrowGap(int fontSize)static floatgetSmallDoubleArrowIconHeight(int fontSize)static java.awt.InsetsgetSpinnerArrowButtonInsets(java.awt.Component c)Returns the spinner arrow button insets under the specified font size.static floatgetSpinnerArrowIconHeight(int fontSize)Returns the height of spinner arrow icons under the specified font size.static floatgetSpinnerArrowIconWidth(int fontSize)Returns the width of spinner arrow icons under the specified font size.static java.awt.InsetsgetSpinnerBorderInsets(int fontSize)Returns the spinner border insets under the specified font size.static java.awt.InsetsgetSpinnerTextBorderInsets(int fontSize)Returns the spinner text border insets under the specified font size.static floatgetSplitPaneArrowIconHeight(int fontSize)Returns the height of split pane divider arrow icons under the specified font size.static floatgetSplitPaneArrowIconWidth(int fontSize)Returns the width of split pane divider arrow icons under the specified font size.static intgetSplitPaneButtonOffset(int fontSize)Returns the offset of the first split pane divider button under the specified font size.static java.awt.InsetsgetTabbedPaneContentInsets(java.awt.Component c)Returns the tabbed pane content insets.static floatgetTabCloseButtonStrokeWidth(java.awt.Component c)Returns the stroke width of tab close buttons.static intgetTabCloseIconSize(int fontSize)Returns the icon size of tab close buttons under the specified size.static java.awt.InsetsgetTableCellRendererInsets(int fontSize)Returns the table cell renderer insets under the specified font size.static java.awt.InsetsgetTextBorderInsets(int fontSize)Returns the text border insets under the specified font size.static intgetTextButtonLRPadding(int fontSize)Returns the text button padding amount on left and right sides under the specified font size.static intgetTextIconGap(int fontSize)Returns the gap between text and icon in buttons and menu items under the specified font size.static intgetTitlePaneHorizontalPadding(int fontSize)static intgetTitlePaneIconSize()Returns the icon size of title pane buttons.static intgetToolBarDragInset(int fontSize)Returns the tool bar drag inset under the specified font size.static java.awt.InsetsgetToolBarInsets(int fontSize)Returns the tool bar insets under the specified font size.static java.awt.InsetsgetToolTipBorderInsets(int fontSize)Returns the tooltip border insets under the specified font size.static java.awt.InsetsgetTreeCellRendererInsets(java.awt.Component c, int fontSize)Returns the tree cell renderer insets under the specified font size.static intgetTreeIconSize(int fontSize)Returns the icon size of tree expand / collapse icons under the specified size.static intgetTreeLeftIndent(int fontSize)static intgetTreeRightIndent(int fontSize)static voidsetControlFontSize(int size)Sets the new value for the control font size.
-
-
-
Method Detail
-
getControlFontSize
public static int getControlFontSize()
Gets the current control font size.- Returns:
- Control font size.
-
setControlFontSize
public static void setControlFontSize(int size)
Sets the new value for the control font size.- Parameters:
size- Control font size.
-
getComponentFontSize
public static int getComponentFontSize(java.awt.Component c)
Computes the font size for the specified component. If the component isnullor doesn't have font set (Component.getFont()returnsnull), this method returns the default control font size fromgetControlFontSize().- Parameters:
c- Component.- Returns:
- Font size for the specified component
-
getAdjustedSize
public static float getAdjustedSize(int fontSize, float baseSize, int forEachBase, float toAdjustBy)Gets the adjusted size. The basic functionality of this method is as follows:- The
baseSizeparameter specifies the base value - The
forEachBaseandtoAdjustByspecify how to adjust the resulting value based on the passedfontSize.
baseSize= 1.2forEachBase= 1toAdjustBy= 0.1
- Parameters:
fontSize- Font size.baseSize- The base value.forEachBase- Base units for computing the adjustment.toAdjustBy- Adjustment amount for computing the adjustment.- Returns:
- Adjusted size.
- The
-
getAdjustedSize
public static int getAdjustedSize(int fontSize, int baseSize, int forEachBase, int toAdjustBy, boolean toRoundAsEven)Gets the adjusted size. The basic functionality of this method is as follows:- The
baseSizeparameter specifies the base value - The
forEachBaseandtoAdjustByspecify how to adjust the resulting value based on the passedfontSize.
baseSize= 4forEachBase= 3toAdjustBy= 1
- Parameters:
fontSize- Font size.baseSize- The base value.forEachBase- Base units for computing the adjustment.toAdjustBy- Adjustment amount for computing the adjustment.toRoundAsEven- Iftrue, the final value will be rounded down to the closest even value.- Returns:
- Adjusted size.
- The
-
getArrowIconHeight
public static float getArrowIconHeight(int fontSize)
Returns the height of arrow icons under the specified font size.- Parameters:
fontSize- Font size.- Returns:
- Height of arrow icons under the specified font size.
-
getArrowIconWidth
public static float getArrowIconWidth(int fontSize)
Returns the width of arrow icons under the specified font size.- Parameters:
fontSize- Font size.- Returns:
- Width of arrow icons under the specified font size.
-
getArrowStrokeWidth
public static float getArrowStrokeWidth(int fontSize)
Returns the stroke width of arrow icons under the specified font size.- Parameters:
fontSize- Font size.- Returns:
- Stroke width of arrow icons under the specified font size.
-
getBorderStrokeWidth
public static float getBorderStrokeWidth(java.awt.Component c)
Returns the stroke width of borders.- Returns:
- Stroke width of borders.
-
getButtonInsets
public static java.awt.Insets getButtonInsets(java.awt.Component c, int fontSize)Returns the button insets under the specified font size.- Parameters:
fontSize- Font size.- Returns:
- Button insets under the specified font size.
-
getCheckBoxBorder
public static javax.swing.border.Border getCheckBoxBorder(int fontSize, boolean ltr)Returns the border for check boxes under the specified font size.- Parameters:
fontSize- Font size.- Returns:
- Border for check boxes under the specified font size.
-
getCheckBoxMarkSize
public static int getCheckBoxMarkSize(int fontSize)
Returns the check mark size for check boxes under the specified font size.- Parameters:
fontSize- Font size.- Returns:
- Check mark size for check boxes under the specified font size.
-
getClassicButtonCornerRadius
public static float getClassicButtonCornerRadius(int fontSize)
Returns the corner radius forClassicButtonShaperunder the specified font size.- Parameters:
fontSize- Font size.- Returns:
- Corner radius for
ClassicButtonShaperunder the specified font size.
-
getComboBorderInsets
public static java.awt.Insets getComboBorderInsets(int fontSize)
Returns the combo box border insets under the specified font size.- Parameters:
fontSize- Font size.- Returns:
- Combo box border insets under the specified font size.
-
getComboLayoutInsets
public static java.awt.Insets getComboLayoutInsets(int fontSize)
Returns the combo box border insets under the specified font size.- Parameters:
fontSize- Font size.- Returns:
- Combo box border insets under the specified font size.
-
getComboTextBorderInsets
public static java.awt.Insets getComboTextBorderInsets(int fontSize)
Returns the combo box text border insets under the specified font size.- Parameters:
fontSize- Font size.- Returns:
- Combo box text border insets under the specified font size.
-
getDefaultBorderInsets
public static java.awt.Insets getDefaultBorderInsets(int fontSize)
Returns the default border insets under the specified font size.- Parameters:
fontSize- Font size.- Returns:
- Default border insets under the specified font size.
-
getDoubleArrowStrokeWidth
public static float getDoubleArrowStrokeWidth(int fontSize)
Returns the stroke width of double arrow icons under the specified font size.- Parameters:
fontSize- Font size.- Returns:
- Stroke width of double arrow icons under the specified font size.
-
getDragBumpDiameter
public static int getDragBumpDiameter(int fontSize)
Returns the diameter of a drag bump dot under the specified font size.- Parameters:
fontSize- Font size.- Returns:
- Diameter of a drag bump dot under the specified font size.
-
getBigDragBumpDiameter
public static int getBigDragBumpDiameter(int fontSize)
Returns the diameter of a big drag bump dot under the specified font size.- Parameters:
fontSize- Font size.- Returns:
- Diameter of a big drag bump dot under the specified font size.
-
getExtraPadding
public static int getExtraPadding(int fontSize)
Returns the extra padding amount under the specified font size.- Parameters:
fontSize- Font size.- Returns:
- Extra padding amount under the specified font size.
-
getFocusRingPadding
public static float getFocusRingPadding(java.awt.Component c, int fontSize)Returns the focus ring padding amount under the specified font size.- Parameters:
fontSize- Font size.- Returns:
- Focus ring padding amount under the specified font size.
-
getFocusStrokeWidth
public static float getFocusStrokeWidth(java.awt.Component c)
Returns the stroke width of focus rings.
-
getCloseIconStrokeWidth
public static float getCloseIconStrokeWidth(int fontSize)
Returns the stroke width of close icon under the specified font size.- Parameters:
fontSize- Font size.- Returns:
- Stroke width of close icon under the specified font size.
-
getListCellRendererInsets
public static java.awt.Insets getListCellRendererInsets(java.awt.Component c, int fontSize)Returns the list cell renderer insets under the specified font size.- Parameters:
fontSize- Font size.- Returns:
- List cell renderer insets under the specified font size.
-
getMenuCheckMarkSize
public static int getMenuCheckMarkSize(int fontSize)
Returns the check mark size of check box menu items and radio button menu items under the specified font size.- Parameters:
fontSize- Font size.- Returns:
- Check mark size of check box menu items and radio button menu items under the specified font size.
-
getMenuItemMargin
public static int getMenuItemMargin(int fontSize)
Returns the margin for menu items under the specified font size.- Parameters:
fontSize- Font size.- Returns:
- Margin for menu items under the specified font size.
-
getTextIconGap
public static int getTextIconGap(int fontSize)
Returns the gap between text and icon in buttons and menu items under the specified font size.- Parameters:
fontSize- Font size.- Returns:
- Gap between text and icon in button menu items under the specified font size.
-
getMinButtonWidth
public static int getMinButtonWidth(int fontSize)
Returns the maximum button height under the specified font size.- Parameters:
fontSize- Font size.- Returns:
- Maximum button height under the specified font size.
-
getPasswordDotDiameter
public static int getPasswordDotDiameter(int fontSize)
Returns the password dot diameter for password fields under the specified font size.- Parameters:
fontSize- Font size.- Returns:
- Password dot diameter for password fields under the specified font size.
-
getPasswordDotGap
public static int getPasswordDotGap(int fontSize)
Returns the password dot gap for password fields under the specified font size.- Parameters:
fontSize- Font size.- Returns:
- Password dot gap for password fields under the specified font size.
-
getRadioButtonBorder
public static javax.swing.border.Border getRadioButtonBorder(int fontSize, boolean ltr)Returns the border for radio buttons under the specified font size.- Parameters:
fontSize- Font size.- Returns:
- Border for radio buttons under the specified font size.
-
getRadioButtonMarkSize
public static int getRadioButtonMarkSize(int fontSize)
Returns the check mark size for radio buttons under the specified font size.- Parameters:
fontSize- Font size.- Returns:
- Check mark size for radio buttons under the specified font size.
-
getScrollBarWidth
public static int getScrollBarWidth(int fontSize)
Returns the width of scroll bars under the specified font size.- Parameters:
fontSize- Font size.- Returns:
- Width of scroll bars under the specified font size.
-
getSliderIconSize
public static int getSliderIconSize(int fontSize)
Returns the slider thumb icon size under the specified font size.- Parameters:
fontSize- Font size.- Returns:
- Slider thumb icon size under the specified font size.
-
getSliderTickSize
public static int getSliderTickSize(int fontSize)
Returns the slider tick size under the specified font size.- Parameters:
fontSize- Font size.- Returns:
- Slider tick size under the specified font size.
-
getSliderTrackSize
public static int getSliderTrackSize(int fontSize)
Returns the slider track size under the specified font size.- Parameters:
fontSize- Font size.- Returns:
- Slider track size under the specified font size.
-
getSmallArrowIconHeight
public static float getSmallArrowIconHeight(int fontSize)
Returns the height of small arrow icons under the specified font size.- Parameters:
fontSize- Font size.- Returns:
- Height of small arrow icons under the specified font size.
-
getSmallDoubleArrowIconHeight
public static float getSmallDoubleArrowIconHeight(int fontSize)
-
getSmallDoubleArrowGap
public static float getSmallDoubleArrowGap(int fontSize)
-
getSmallArrowIconWidth
public static float getSmallArrowIconWidth(int fontSize)
Returns the width of small arrow icons under the specified font size.- Parameters:
fontSize- Font size.- Returns:
- Width of small arrow icons under the specified font size.
-
getSpinnerArrowIconHeight
public static float getSpinnerArrowIconHeight(int fontSize)
Returns the height of spinner arrow icons under the specified font size.- Parameters:
fontSize- Font size.- Returns:
- Height of spinner arrow icons under the specified font size.
-
getSpinnerArrowIconWidth
public static float getSpinnerArrowIconWidth(int fontSize)
Returns the width of spinner arrow icons under the specified font size.- Parameters:
fontSize- Font size.- Returns:
- Width of spinner arrow icons under the specified font size.
-
getSpinnerBorderInsets
public static java.awt.Insets getSpinnerBorderInsets(int fontSize)
Returns the spinner border insets under the specified font size.- Parameters:
fontSize- Font size.- Returns:
- Spinner border insets under the specified font size.
-
getSpinnerArrowButtonInsets
public static java.awt.Insets getSpinnerArrowButtonInsets(java.awt.Component c)
Returns the spinner arrow button insets under the specified font size.- Returns:
- Spinner arrow button insets under the specified font size.
-
getSpinnerTextBorderInsets
public static java.awt.Insets getSpinnerTextBorderInsets(int fontSize)
Returns the spinner text border insets under the specified font size.- Parameters:
fontSize- Font size.- Returns:
- Spinner text border insets under the specified font size.
-
getSplitPaneArrowIconHeight
public static float getSplitPaneArrowIconHeight(int fontSize)
Returns the height of split pane divider arrow icons under the specified font size.- Parameters:
fontSize- Font size.- Returns:
- Height of split pane divider arrow icons under the specified font size.
-
getSplitPaneArrowIconWidth
public static float getSplitPaneArrowIconWidth(int fontSize)
Returns the width of split pane divider arrow icons under the specified font size.- Parameters:
fontSize- Font size.- Returns:
- Width of split pane divider arrow icons under the specified font size.
-
getSplitPaneButtonOffset
public static int getSplitPaneButtonOffset(int fontSize)
Returns the offset of the first split pane divider button under the specified font size.- Parameters:
fontSize- Font size.- Returns:
- Offset of the first split pane divider button under the specified font size.
-
getTabbedPaneContentInsets
public static java.awt.Insets getTabbedPaneContentInsets(java.awt.Component c)
Returns the tabbed pane content insets. TheRadianceThemingSlices.TabContentPaneBorderKind.SINGLE_PLACEMENTis assumed.- Returns:
- Tabbed pane content insets.
-
getTabCloseButtonStrokeWidth
public static float getTabCloseButtonStrokeWidth(java.awt.Component c)
Returns the stroke width of tab close buttons.- Returns:
- Stroke width of tab close buttons.
-
getTabCloseIconSize
public static int getTabCloseIconSize(int fontSize)
Returns the icon size of tab close buttons under the specified size.- Parameters:
fontSize- Font size.- Returns:
- Icon size of tab close buttons under the specified size.
-
getTableCellRendererInsets
public static java.awt.Insets getTableCellRendererInsets(int fontSize)
Returns the table cell renderer insets under the specified font size.- Parameters:
fontSize- Font size.- Returns:
- Table cell renderer insets under the specified font size.
-
getTextBorderInsets
public static java.awt.Insets getTextBorderInsets(int fontSize)
Returns the text border insets under the specified font size.- Parameters:
fontSize- Font size.- Returns:
- Text border insets under the specified font size.
-
getTextButtonLRPadding
public static int getTextButtonLRPadding(int fontSize)
Returns the text button padding amount on left and right sides under the specified font size.- Parameters:
fontSize- Font size.- Returns:
- Text button padding amount on left and right sides under the specified font size.
-
getTitlePaneIconSize
public static int getTitlePaneIconSize()
Returns the icon size of title pane buttons.- Returns:
- Icon size of title pane buttons.
-
getToolBarDragInset
public static int getToolBarDragInset(int fontSize)
Returns the tool bar drag inset under the specified font size.- Parameters:
fontSize- Font size.- Returns:
- Tool bar drag inset under the specified font size.
-
getToolBarInsets
public static java.awt.Insets getToolBarInsets(int fontSize)
Returns the tool bar insets under the specified font size.- Parameters:
fontSize- Font size.- Returns:
- Tool bar insets under the specified font size.
-
getToolTipBorderInsets
public static java.awt.Insets getToolTipBorderInsets(int fontSize)
Returns the tooltip border insets under the specified font size.- Parameters:
fontSize- Font size.- Returns:
- Tooltip border insets under the specified font size.
-
getTreeCellRendererInsets
public static java.awt.Insets getTreeCellRendererInsets(java.awt.Component c, int fontSize)Returns the tree cell renderer insets under the specified font size.- Parameters:
fontSize- Font size.- Returns:
- Tree cell renderer insets under the specified font size.
-
getTreeIconSize
public static int getTreeIconSize(int fontSize)
Returns the icon size of tree expand / collapse icons under the specified size.- Parameters:
fontSize- Font size.- Returns:
- Icon size of tree expand / collapse icons under the specified size.
-
getTreeLeftIndent
public static int getTreeLeftIndent(int fontSize)
-
getTreeRightIndent
public static int getTreeRightIndent(int fontSize)
-
getLookupButtonSize
public static int getLookupButtonSize()
Returns the size of the lookup button.- Returns:
- The size of the lookup button.
-
getTitlePaneHorizontalPadding
public static int getTitlePaneHorizontalPadding(int fontSize)
-
-