Class RadianceCoreUtilities
- java.lang.Object
-
- org.pushingpixels.radiance.theming.internal.utils.RadianceCoreUtilities
-
public class RadianceCoreUtilities extends java.lang.Object
Various utility functions. This class is for internal use only.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
RadianceCoreUtilities.TextComponentAware<T extends javax.swing.JComponent>
-
Field Summary
Fields Modifier and Type Field Description private static java.util.List<java.awt.event.AWTEventListener>
awtEventListeners
static java.lang.String
IS_COVERED_BY_LIGHTWEIGHT_POPUPS
Client property name for marking components covered by lightweight popups.static java.lang.String
TEXT_COMPONENT_AWARE
-
Constructor Summary
Constructors Modifier Constructor Description private
RadianceCoreUtilities()
Private constructor.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
canReplaceChildBackgroundColor(java.awt.Color background)
static java.lang.String
clipString(java.awt.FontMetrics metrics, int availableWidth, java.lang.String fullText)
Clips string based on specified font metrics and available width (in pixels).static RadianceThemingSlices.IconFilterStrategy
getActiveIconFilterStrategy(javax.swing.JComponent comp)
static javax.swing.Icon
getArrowIcon(javax.swing.AbstractButton button, int orientation)
Returns the arrow icon.static javax.swing.Icon
getArrowIcon(javax.swing.JComponent comp, BladeTransitionAwareIcon.TransitionAwareUIDelegate transitionAwareUIDelegate, int orientation)
Returns the arrow icon.static java.util.List<java.awt.event.AWTEventListener>
getAwtEventListeners()
static java.awt.Color
getBackgroundFill(RadianceSkin skin, RadianceThemingSlices.DecorationAreaType decorationAreaType)
static java.awt.image.BufferedImage
getBlankImage(double scale, int width, int height)
Retrieves transparent image of specified dimension.static RadianceBorderPainter
getBorderPainter(java.awt.Component comp)
Returns the border painter for the specified component.static int
getButtonBarGravity(java.awt.Container c)
static RadianceButtonShaper
getButtonShaper(java.awt.Component comp)
Returns the button shaper of the specified button.static java.lang.ClassLoader
getClassLoaderForResources()
Returns the class loader for loading the resource files.static int
getCloseButtonSize(javax.swing.JTabbedPane tabbedPane, int tabIndex)
Returns the size of the close button for a tab in the specified tabbed pane.static double
getColorizationFactor(java.awt.Component c)
Returns the colorization factor for the specified component.static <T> T
getComboPopupPrototypeDisplayValue(javax.swing.JComboBox<T> combo)
Returns the popup prototype display value for the specified combo box.static RadianceThemingSlices.TabContentPaneBorderKind
getContentBorderKind(javax.swing.JTabbedPane tabbedPane)
Returns the content border kind of the specified tabbed pane.static RadianceThemingSlices.IconFilterStrategy
getDisabledIconFilterStrategy(javax.swing.JComponent comp)
static int
getEchoPerChar(javax.swing.JPasswordField jpf)
Returns the number of echo characters per each password character.static RadianceThemingSlices.IconFilterStrategy
getEnabledIconFilterStrategy(javax.swing.JComponent comp)
static RadianceFillPainter
getFillPainter(java.awt.Component comp)
Returns the fill painter of the specified component.static javax.swing.Icon
getFilteredIcon(javax.swing.JComponent comp, javax.swing.Icon orig, ComponentState componentState, java.awt.Color textColor)
static javax.swing.Icon
getFilteredIcon(javax.swing.JTabbedPane tab, javax.swing.Icon orig, ComponentState componentState, java.awt.Color textColor)
static RadianceThemingSlices.FocusKind
getFocusKind(java.awt.Component component)
Returns the focus ring kind of the specified component.static HashMapKey
getHashKey(java.lang.Object... objects)
Returns a hash key for the specified parameters.static java.awt.Container
getHeaderParent(java.awt.Component c)
Given a component, returns the parent for computing theRadianceDecorationPainter
.static java.lang.String
getHierarchy(java.awt.Component comp)
Returns the component hierarchy.static void
getHierarchy(java.awt.Component comp, java.lang.StringBuffer buffer, int level)
Computes the component hierarchy.static RadianceBorderPainter
getHighlightBorderPainter(java.awt.Component comp)
Returns the highlight border painter for the specified component.static RadianceThemingSlices.IconFilterStrategy
getIconFilterStrategy(javax.swing.JComponent component, ComponentState componentState)
static float
getMenuGutterFillAlpha()
Returns the global menu gutter fill alpha.static java.awt.Point
getOffsetInRootPaneCoords(java.awt.Component comp)
static javax.swing.Icon
getOriginalIcon(javax.swing.AbstractButton b, javax.swing.Icon defaultIcon)
static java.awt.Dimension
getPlacementAwarePopupShift(boolean ltr, java.awt.Dimension anchorDimension, java.awt.Dimension popupDimension, java.awt.Insets popupInsets, RadianceThemingSlices.PopupPlacementStrategy popupPlacementStrategy)
static int
getPopupParentIndexOf(java.awt.Component comp, java.awt.Component[] popups)
Gets a component and a list of popups and returns the index of the popup that is a parent of the specified component.static RadianceThemingSlices.PopupPlacementStrategy
getPopupPlacementStrategy(javax.swing.JComboBox combobox)
Returns the popup placement strategy for the specified combobox.static java.awt.image.BufferedImage
getScaledIconImage(double scale, java.util.List<java.awt.Image> imageList, int width, int height)
ScansimageList
for best-looking image of specified dimensions.static RadianceThemingSlices.SeparatorAppearance
getSeparatorAppearance(javax.swing.JSeparator separator)
Returns the appearance for the specified separator.static java.util.Set<RadianceThemingSlices.Side>
getSides(javax.swing.JComponent component, java.lang.String propertyName)
Returns the set of sides registered on the specified button.static RadianceSkin
getSkin(java.awt.Component c)
Returns the skin of the specified component.static TabCloseCallback
getTabCloseCallback(javax.swing.JTabbedPane tabbedPane, int tabIndex)
Returns the callback to be called upon tab closing (using the tab close button).static java.awt.Color
getTextBackgroundFill(java.awt.Component component, ComponentState componentState)
static javax.swing.text.JTextComponent
getTextComponentForTransitions(java.awt.Component c)
static SwingRepaintCallback
getTextComponentRepaintCallback(javax.swing.text.JTextComponent textComponent)
static java.awt.Color
getTextSelectionBackground(java.awt.Component component, ComponentState componentState)
static java.awt.Color
getTextSelectionForeground(java.awt.Component component, ComponentState componentState)
static TitlePaneButtonsProvider
getTitlePaneButtonsProvider(javax.swing.JRootPane rootPane)
static javax.swing.JComponent
getTitlePaneComponent(java.awt.Window window)
Returns the title pane of the specified top-level window.static float
getToolbarButtonCornerRadius(javax.swing.JComponent button, float insets)
Returns the corner radius of the specified toolbar button.static java.awt.Component
getTopMostParentWithDecorationAreaType(java.awt.Component comp, RadianceThemingSlices.DecorationAreaType type)
static boolean
hasCloseButton(javax.swing.JTabbedPane tabbedPane, int tabIndex)
Checks whether the specified tab has a close button.static boolean
hasFlatAppearance(java.awt.Component comp, boolean defaultValue)
Checks whether the specified component is flat.static boolean
hasFlatAppearance(javax.swing.AbstractButton button)
Computes whether the specified button has flat appearance.static boolean
hasIcon(javax.swing.AbstractButton button)
Checks whether the specified button has associated icon.static boolean
hasNoMinSizeProperty(javax.swing.AbstractButton button)
Checks whether the specified button should have minimal size.static boolean
hasText(javax.swing.AbstractButton button)
Checks whether the specified button has associated text.static boolean
isComboBoxButton(javax.swing.AbstractButton button)
Checks and answers if the specified button is in a combo box.static boolean
isComponentNeverPainted(java.awt.Component component)
Checks whether the specified button never paints its background.static boolean
isCoveredByLightweightPopups(java.awt.Component comp)
static boolean
isCurrentLookAndFeel()
Checks whether Radiance is the current look-and-feel.static boolean
isOpaque(javax.swing.JComponent c)
static boolean
isRootPaneModified(javax.swing.JRootPane rootPane)
Retrieves themodified
state for the specified root pane.static boolean
isScrollBarButton(javax.swing.AbstractButton button)
Checks and answers if the specified button is in a scroll bar.static boolean
isTabModified(java.awt.Component tabComponent)
Retrieves themodified
state for the specified component in a tabbed pane.static boolean
isToolBarButton(javax.swing.JComponent component)
Checks and answers if the specified button is in a toolbar.static void
makeNonOpaque(java.awt.Component comp, java.util.Map<java.awt.Component,java.lang.Boolean> opacitySnapshot)
Makes the specified component and all its descendants non-opaque.static void
markButtonAsFlat(javax.swing.AbstractButton button)
Marks the specified button asflat
.static void
paintFocus(java.awt.Graphics g, java.awt.Component mainComp, java.awt.Component focusedComp, TransitionAwareUI transitionAwareUI, double scaleFactor, java.awt.Shape focusShape, java.awt.Rectangle textRect, float maxAlphaCoef, float extraPadding)
static void
paintFocus(java.awt.Graphics g, java.awt.Component mainComp, java.awt.Component focusedComp, TransitionAwareUI transitionAwareUI, double scaleFactor, java.awt.Shape focusShape, java.awt.Rectangle textRect, java.awt.Color focusColor, float maxAlphaCoef, float extraPadding)
static int
placementStrategyToOrientation(javax.swing.JComponent comp, RadianceThemingSlices.PopupPlacementStrategy popupPlacementStrategy)
static void
registerAWTEventListener(java.awt.event.AWTEventListener awtEventListener)
static void
restoreOpaque(java.awt.Component comp, java.util.Map<java.awt.Component,java.lang.Boolean> opacitySnapshot)
Restores the opacity of the specified component and all its descendants.static void
stopThreads()
Stops all Radiance threads.static void
testComponentCreationThreadingViolation(java.awt.Component comp)
Tests UI threading violations on creating the specified component.static void
testComponentStateChangeThreadingViolation(java.awt.Component comp)
Tests UI threading violations on changing the state the specified component.static void
testWindowCloseThreadingViolation(java.awt.Window w)
Tests UI threading violations on closing the specified window.static boolean
toAnimateCloseIconOfModifiedTab(javax.swing.JTabbedPane tabbedPane, int tabIndex)
Checks whether the specified tab should show modified animation only on its close button.static boolean
toShowExtraWidgets(java.awt.Component component)
Checks whether the specified component can show extra Radiance-specific UI elements.static void
traceRadianceApiUsage(java.awt.Component comp, java.lang.String message)
static void
uninstallMenu(javax.swing.JMenuItem menuItem)
Uninstalls the specified menu item.static void
unregisterAWTEventListener(java.awt.event.AWTEventListener awtEventListener)
static void
updateActiveUi()
-
-
-
Field Detail
-
IS_COVERED_BY_LIGHTWEIGHT_POPUPS
public static final java.lang.String IS_COVERED_BY_LIGHTWEIGHT_POPUPS
Client property name for marking components covered by lightweight popups. This is tracking the fix for issue 297. The client property value should be an instance ofBoolean
.- See Also:
- Constant Field Values
-
TEXT_COMPONENT_AWARE
public static final java.lang.String TEXT_COMPONENT_AWARE
- See Also:
- Constant Field Values
-
awtEventListeners
private static java.util.List<java.awt.event.AWTEventListener> awtEventListeners
-
-
Method Detail
-
clipString
public static java.lang.String clipString(java.awt.FontMetrics metrics, int availableWidth, java.lang.String fullText)
Clips string based on specified font metrics and available width (in pixels). Returns the clipped string, which contains the beginning and the end of the input string separated by ellipses (...) in case the string is too long to fit into the specified width, and the original string otherwise.- Parameters:
metrics
- Font metrics.availableWidth
- Available width in pixels.fullText
- String to clip.- Returns:
- The clipped string, which contains the beginning and the end of the input string separated by ellipses (...) in case the string is too long to fit into the specified width, and the original string otherwise.
-
hasIcon
public static boolean hasIcon(javax.swing.AbstractButton button)
Checks whether the specified button has associated icon.- Parameters:
button
- Button.- Returns:
- If the button has associated icon,
true
is returned, otherwisefalse
.
-
hasText
public static boolean hasText(javax.swing.AbstractButton button)
Checks whether the specified button has associated text.- Parameters:
button
- Button.- Returns:
- If the button has associated text,
true
is returned, otherwisefalse
.
-
isComboBoxButton
public static boolean isComboBoxButton(javax.swing.AbstractButton button)
Checks and answers if the specified button is in a combo box.- Parameters:
button
- the button to check- Returns:
true
if in combo box,false
otherwise
-
isScrollBarButton
public static boolean isScrollBarButton(javax.swing.AbstractButton button)
Checks and answers if the specified button is in a scroll bar.- Parameters:
button
- the button to check- Returns:
true
if in scroll bar,false
otherwise
-
isToolBarButton
public static boolean isToolBarButton(javax.swing.JComponent component)
Checks and answers if the specified button is in a toolbar.- Parameters:
component
- the button to check- Returns:
true
if in toolbar,false
otherwise
-
isComponentNeverPainted
public static boolean isComponentNeverPainted(java.awt.Component component)
Checks whether the specified button never paints its background.- Parameters:
component
- Button.- Returns:
true
if the specified button never paints its background,false
otherwise.- See Also:
RadianceThemingCortex.GlobalScope.setBackgroundAppearanceStrategy(RadianceThemingSlices.BackgroundAppearanceStrategy)
-
getFocusKind
public static RadianceThemingSlices.FocusKind getFocusKind(java.awt.Component component)
Returns the focus ring kind of the specified component.- Parameters:
component
- Component.- Returns:
- The focus ring kind of the specified component.
-
getButtonShaper
public static RadianceButtonShaper getButtonShaper(java.awt.Component comp)
Returns the button shaper of the specified button.- Parameters:
comp
- The button.- Returns:
- The button shaper of the specified button.
- See Also:
RadianceThemingCortex.ComponentScope.setButtonShaper(JComponent, RadianceButtonShaper)
,RadianceSkin.getButtonShaper()
-
getFillPainter
public static RadianceFillPainter getFillPainter(java.awt.Component comp)
Returns the fill painter of the specified component.- Parameters:
comp
- Component.- Returns:
- The fill painter of the specified component.
- See Also:
RadianceSkin.getFillPainter()
-
isTabModified
public static boolean isTabModified(java.awt.Component tabComponent)
Retrieves themodified
state for the specified component in a tabbed pane.- Parameters:
tabComponent
- The associated tab component.- Returns:
true
if the specified component in a tabbed pane is marked as modified,false
otherwise.- See Also:
RadianceThemingCortex.ComponentScope.setTabContentsModified(JComponent, Boolean)
-
isRootPaneModified
public static boolean isRootPaneModified(javax.swing.JRootPane rootPane)
Retrieves themodified
state for the specified root pane.- Parameters:
rootPane
- The root pane.- Returns:
true
if the specified root pane is marked as modified,false
otherwise.- See Also:
RadianceThemingCortex.RootPaneScope.setContentsModified(JRootPane, Boolean)
-
getTitlePaneButtonsProvider
public static TitlePaneButtonsProvider getTitlePaneButtonsProvider(javax.swing.JRootPane rootPane)
-
hasCloseButton
public static boolean hasCloseButton(javax.swing.JTabbedPane tabbedPane, int tabIndex)
Checks whether the specified tab has a close button.- Parameters:
tabbedPane
- Tabbed pane.tabIndex
- Tab index.- Returns:
true
if the specified tab has a close button,false
otherwise.
-
getCloseButtonSize
public static int getCloseButtonSize(javax.swing.JTabbedPane tabbedPane, int tabIndex)
Returns the size of the close button for a tab in the specified tabbed pane.- Parameters:
tabbedPane
- Tabbed pane.tabIndex
- Tab index.- Returns:
- The size of the close button for a tab in the specified tabbed pane.
-
getContentBorderKind
public static RadianceThemingSlices.TabContentPaneBorderKind getContentBorderKind(javax.swing.JTabbedPane tabbedPane)
Returns the content border kind of the specified tabbed pane.- Parameters:
tabbedPane
- Tabbed pane.- Returns:
- Content border kind of the specified tabbed pane.
- See Also:
RadianceThemingCortex.GlobalScope.setTabContentPaneBorderKind(RadianceThemingSlices.TabContentPaneBorderKind)
,RadianceThemingCortex.ComponentScope.setTabContentPaneBorderKind(JTabbedPane, RadianceThemingSlices.TabContentPaneBorderKind)
-
toAnimateCloseIconOfModifiedTab
public static boolean toAnimateCloseIconOfModifiedTab(javax.swing.JTabbedPane tabbedPane, int tabIndex)
Checks whether the specified tab should show modified animation only on its close button.- Parameters:
tabbedPane
- Tabbed pane.tabIndex
- Tab index.- Returns:
true
if the specified tab should show modified animation only on its close button,false
otherwise.
-
getBlankImage
public static java.awt.image.BufferedImage getBlankImage(double scale, int width, int height)
Retrieves transparent image of specified dimension.- Parameters:
width
- Image width.height
- Image height.- Returns:
- Transparent image of specified dimension.
-
hasNoMinSizeProperty
public static boolean hasNoMinSizeProperty(javax.swing.AbstractButton button)
Checks whether the specified button should have minimal size.- Parameters:
button
- Button.- Returns:
false
if the specified button should have minimal size,true
otherwise.- See Also:
RadianceThemingCortex.ComponentOrParentScope.setButtonIgnoreMinimumSize(JComponent, Boolean)
,RadianceThemingCortex.GlobalScope.setButtonIgnoreMinimumSize(Boolean)
-
markButtonAsFlat
public static void markButtonAsFlat(javax.swing.AbstractButton button)
Marks the specified button asflat
. A flat button doesn't show its background unless selected, armed, pressed or (possibly) hovered over.- Parameters:
button
- Button to mark as flat.
-
hasFlatAppearance
public static boolean hasFlatAppearance(java.awt.Component comp, boolean defaultValue)
Checks whether the specified component is flat.- Parameters:
comp
- Component.defaultValue
- The value to return.- Returns:
false
if the specified button is flat,true
otherwise.- See Also:
RadianceThemingCortex.ComponentOrParentScope.setBackgroundAppearanceStrategy(JComponent, RadianceThemingSlices.BackgroundAppearanceStrategy)
,RadianceThemingCortex.GlobalScope.setBackgroundAppearanceStrategy(RadianceThemingSlices.BackgroundAppearanceStrategy)
-
hasFlatAppearance
public static boolean hasFlatAppearance(javax.swing.AbstractButton button)
Computes whether the specified button has flat appearance.- Parameters:
button
- Button.- Returns:
true
if the button has flat appearance,false
otherwise.
-
getPopupPlacementStrategy
public static RadianceThemingSlices.PopupPlacementStrategy getPopupPlacementStrategy(javax.swing.JComboBox combobox)
Returns the popup placement strategy for the specified combobox.- Parameters:
combobox
- Combobox.- Returns:
- The popup placement strategy for the specified combobox.
- See Also:
RadianceThemingCortex.ComponentScope.setComboBoxPopupPlacementStrategy(JComboBox, RadianceThemingSlices.PopupPlacementStrategy)
,RadianceThemingCortex.GlobalScope.setComboBoxPopupPlacementStrategy(RadianceThemingSlices.PopupPlacementStrategy)
-
makeNonOpaque
public static void makeNonOpaque(java.awt.Component comp, java.util.Map<java.awt.Component,java.lang.Boolean> opacitySnapshot)
Makes the specified component and all its descendants non-opaque.- Parameters:
comp
- Component.opacitySnapshot
- The "snapshot" map that will contain the original opacity status of the specified component and all its descendants.
-
restoreOpaque
public static void restoreOpaque(java.awt.Component comp, java.util.Map<java.awt.Component,java.lang.Boolean> opacitySnapshot)
Restores the opacity of the specified component and all its descendants.- Parameters:
comp
- Component.opacitySnapshot
- The "snapshot" map that contains the original opacity status of the specified component and all its descendants.
-
getActiveIconFilterStrategy
public static RadianceThemingSlices.IconFilterStrategy getActiveIconFilterStrategy(javax.swing.JComponent comp)
-
getEnabledIconFilterStrategy
public static RadianceThemingSlices.IconFilterStrategy getEnabledIconFilterStrategy(javax.swing.JComponent comp)
-
getDisabledIconFilterStrategy
public static RadianceThemingSlices.IconFilterStrategy getDisabledIconFilterStrategy(javax.swing.JComponent comp)
-
getTabCloseCallback
public static TabCloseCallback getTabCloseCallback(javax.swing.JTabbedPane tabbedPane, int tabIndex)
Returns the callback to be called upon tab closing (using the tab close button).- Parameters:
tabbedPane
- Tabbed pane.tabIndex
- Tab index.- Returns:
- Callback to be called upon tab closing (using the tab close button).
- See Also:
RadianceThemingCortex.ComponentScope.setTabCloseCallback(JTabbedPane, TabCloseCallback)
,RadianceThemingCortex.GlobalScope.setTabCloseCallback(TabCloseCallback)
-
getComboPopupPrototypeDisplayValue
public static <T> T getComboPopupPrototypeDisplayValue(javax.swing.JComboBox<T> combo)
Returns the popup prototype display value for the specified combo box. This value is used to compute the width of the combo popup.- Parameters:
combo
- Combo box.- Returns:
- The popup prototype display value for the specified combo box.
-
getSides
public static java.util.Set<RadianceThemingSlices.Side> getSides(javax.swing.JComponent component, java.lang.String propertyName)
Returns the set of sides registered on the specified button.- Parameters:
component
- Button.propertyName
- Client property name for retrieving the registered sides.- Returns:
- Set of sides registered on the specified button.
-
getToolbarButtonCornerRadius
public static float getToolbarButtonCornerRadius(javax.swing.JComponent button, float insets)
Returns the corner radius of the specified toolbar button.- Parameters:
button
- Toolbar button.insets
- Button insets.- Returns:
- Corner radius of the specified toolbar button.
- See Also:
RadianceThemingCortex.ComponentScope.setToolbarButtonCornerRadius(AbstractButton, float)
,RadianceThemingCortex.GlobalScope.setToolbarButtonCornerRadius(float)
-
getEchoPerChar
public static int getEchoPerChar(javax.swing.JPasswordField jpf)
Returns the number of echo characters per each password character.- Parameters:
jpf
- Password field.- Returns:
- The number of echo characters per each password character.
-
toShowExtraWidgets
public static boolean toShowExtraWidgets(java.awt.Component component)
Checks whether the specified component can show extra Radiance-specific UI elements.- Parameters:
component
- Component.- Returns:
true
if the specified component can show extra Radiance-specific UI elements,false
otherwise.- See Also:
RadianceThemingCortex.ComponentOrParentChainScope.setExtraWidgetsPresence(JComponent, Boolean)
,RadianceThemingCortex.GlobalScope.setExtraWidgetsPresence(Boolean)
-
getIconFilterStrategy
public static RadianceThemingSlices.IconFilterStrategy getIconFilterStrategy(javax.swing.JComponent component, ComponentState componentState)
-
getFilteredIcon
public static javax.swing.Icon getFilteredIcon(javax.swing.JComponent comp, javax.swing.Icon orig, ComponentState componentState, java.awt.Color textColor)
-
getFilteredIcon
public static javax.swing.Icon getFilteredIcon(javax.swing.JTabbedPane tab, javax.swing.Icon orig, ComponentState componentState, java.awt.Color textColor)
-
getOriginalIcon
public static javax.swing.Icon getOriginalIcon(javax.swing.AbstractButton b, javax.swing.Icon defaultIcon)
-
getMenuGutterFillAlpha
public static float getMenuGutterFillAlpha()
Returns the global menu gutter fill alpha.- Returns:
- The global menu gutter fill alpha.
-
getSeparatorAppearance
public static RadianceThemingSlices.SeparatorAppearance getSeparatorAppearance(javax.swing.JSeparator separator)
Returns the appearance for the specified separator.- Parameters:
separator
- Separator.- Returns:
- Its appearance.
- See Also:
RadianceThemingCortex.ComponentScope.setSeparatorAppearance(JSeparator, RadianceThemingSlices.SeparatorAppearance)
-
getHeaderParent
public static java.awt.Container getHeaderParent(java.awt.Component c)
Given a component, returns the parent for computing theRadianceDecorationPainter
.- Parameters:
c
- Component.- Returns:
- The parent for computing the
RadianceDecorationPainter
.
-
paintFocus
public static void paintFocus(java.awt.Graphics g, java.awt.Component mainComp, java.awt.Component focusedComp, TransitionAwareUI transitionAwareUI, double scaleFactor, java.awt.Shape focusShape, java.awt.Rectangle textRect, float maxAlphaCoef, float extraPadding)
-
paintFocus
public static void paintFocus(java.awt.Graphics g, java.awt.Component mainComp, java.awt.Component focusedComp, TransitionAwareUI transitionAwareUI, double scaleFactor, java.awt.Shape focusShape, java.awt.Rectangle textRect, java.awt.Color focusColor, float maxAlphaCoef, float extraPadding)
-
uninstallMenu
public static void uninstallMenu(javax.swing.JMenuItem menuItem)
Uninstalls the specified menu item.- Parameters:
menuItem
- Menu item.
-
getClassLoaderForResources
public static java.lang.ClassLoader getClassLoaderForResources()
Returns the class loader for loading the resource files. It is a fix by Dag Joar and Christian Schlichtherle for application running with -Xbootclasspath VM flag. In this case, using MyClass.class.getClassLoader() would return null, but the context class loader will function properly that classes will be properly loaded regardless of whether the lib is added to the system class path, the extension class path and regardless of the class loader architecture set up by some frameworks.- Returns:
- The class loader for loading the resource files.
-
isCoveredByLightweightPopups
public static boolean isCoveredByLightweightPopups(java.awt.Component comp)
-
getPopupParentIndexOf
public static int getPopupParentIndexOf(java.awt.Component comp, java.awt.Component[] popups)
Gets a component and a list of popups and returns the index of the popup that is a parent of the specified component. Is used to track issue 297 and prevent visual artifacts.- Parameters:
comp
- Component.popups
- List of popups.- Returns:
- Index of the popup which is component's parent if any, or the popup list length otherwise.
-
getBorderPainter
public static RadianceBorderPainter getBorderPainter(java.awt.Component comp)
Returns the border painter for the specified component.- Parameters:
comp
- Component.- Returns:
- Border painter for the specified component.
- See Also:
RadianceSkin.getBorderPainter()
-
getHighlightBorderPainter
public static RadianceBorderPainter getHighlightBorderPainter(java.awt.Component comp)
Returns the highlight border painter for the specified component.- Parameters:
comp
- Component.- Returns:
- Highlight border painter for the specified component.
- See Also:
RadianceSkin.getBorderPainter()
,RadianceSkin.getHighlightBorderPainter()
-
getHierarchy
public static java.lang.String getHierarchy(java.awt.Component comp)
Returns the component hierarchy.- Parameters:
comp
- Component.- Returns:
- Component hierarchy string.
-
getHierarchy
public static void getHierarchy(java.awt.Component comp, java.lang.StringBuffer buffer, int level)
Computes the component hierarchy.- Parameters:
comp
- Component.buffer
- Hierarchy representation buffer.level
- Hierarchy level.
-
getArrowIcon
public static javax.swing.Icon getArrowIcon(javax.swing.AbstractButton button, int orientation)
Returns the arrow icon.- Parameters:
button
- Button.orientation
- Arrow orientation.- Returns:
- Arrow icon.
-
getArrowIcon
public static javax.swing.Icon getArrowIcon(javax.swing.JComponent comp, BladeTransitionAwareIcon.TransitionAwareUIDelegate transitionAwareUIDelegate, int orientation)
Returns the arrow icon.- Parameters:
comp
- Component.orientation
- Arrow orientation.- Returns:
- Arrow icon.
-
placementStrategyToOrientation
public static int placementStrategyToOrientation(javax.swing.JComponent comp, RadianceThemingSlices.PopupPlacementStrategy popupPlacementStrategy)
-
getPlacementAwarePopupShift
public static java.awt.Dimension getPlacementAwarePopupShift(boolean ltr, java.awt.Dimension anchorDimension, java.awt.Dimension popupDimension, java.awt.Insets popupInsets, RadianceThemingSlices.PopupPlacementStrategy popupPlacementStrategy)
-
getColorizationFactor
public static double getColorizationFactor(java.awt.Component c)
Returns the colorization factor for the specified component.- Parameters:
c
- Component.- Returns:
- The colorization factor for the specified component.
- See Also:
RadianceThemingCortex.ComponentOrParentChainScope.setColorizationFactor(JComponent, double)
,RadianceThemingCortex.GlobalScope.setColorizationFactor(double)
-
getSkin
public static RadianceSkin getSkin(java.awt.Component c)
Returns the skin of the specified component.- Parameters:
c
- Component.- Returns:
- The skin of the specified component.
-
getHashKey
public static HashMapKey getHashKey(java.lang.Object... objects)
Returns a hash key for the specified parameters.- Parameters:
objects
- Key components.- Returns:
- Hash key.
-
stopThreads
public static void stopThreads()
Stops all Radiance threads. Improper use may result in UI artifacts and runtime exceptions.
-
testComponentCreationThreadingViolation
public static void testComponentCreationThreadingViolation(java.awt.Component comp)
Tests UI threading violations on creating the specified component.- Parameters:
comp
- Component.- Throws:
UiThreadingViolationException
- If the component is created off Event Dispatch Thread.
-
testComponentStateChangeThreadingViolation
public static void testComponentStateChangeThreadingViolation(java.awt.Component comp)
Tests UI threading violations on changing the state the specified component.- Parameters:
comp
- Component.- Throws:
UiThreadingViolationException
- If the component is changing state off Event Dispatch Thread.
-
testWindowCloseThreadingViolation
public static void testWindowCloseThreadingViolation(java.awt.Window w)
Tests UI threading violations on closing the specified window.- Parameters:
w
- Window.- Throws:
UiThreadingViolationException
- If the window is closed off Event Dispatch Thread.
-
traceRadianceApiUsage
public static void traceRadianceApiUsage(java.awt.Component comp, java.lang.String message)
-
getScaledIconImage
public static java.awt.image.BufferedImage getScaledIconImage(double scale, java.util.List<java.awt.Image> imageList, int width, int height)
ScansimageList
for best-looking image of specified dimensions. Image can be scaled and/or padded with transparency.
-
canReplaceChildBackgroundColor
public static boolean canReplaceChildBackgroundColor(java.awt.Color background)
-
getTextComponentForTransitions
public static javax.swing.text.JTextComponent getTextComponentForTransitions(java.awt.Component c)
-
getTextComponentRepaintCallback
public static SwingRepaintCallback getTextComponentRepaintCallback(javax.swing.text.JTextComponent textComponent)
-
isOpaque
public static boolean isOpaque(javax.swing.JComponent c)
-
isCurrentLookAndFeel
public static boolean isCurrentLookAndFeel()
Checks whether Radiance is the current look-and-feel. This method is for internal use only.- Returns:
true
if Radiance is the current look-and-feel,false
otherwise.
-
getButtonBarGravity
public static int getButtonBarGravity(java.awt.Container c)
-
getTitlePaneComponent
public static javax.swing.JComponent getTitlePaneComponent(java.awt.Window window)
Returns the title pane of the specified top-level window.- Parameters:
window
- Top-level window.- Returns:
- If the parameter is either
JFrame
orJDialog
and has custom decorations, the result is the title pane,null
otherwise.
-
updateActiveUi
public static void updateActiveUi()
-
getOffsetInRootPaneCoords
public static java.awt.Point getOffsetInRootPaneCoords(java.awt.Component comp)
-
getTopMostParentWithDecorationAreaType
public static java.awt.Component getTopMostParentWithDecorationAreaType(java.awt.Component comp, RadianceThemingSlices.DecorationAreaType type)
-
registerAWTEventListener
public static void registerAWTEventListener(java.awt.event.AWTEventListener awtEventListener)
-
unregisterAWTEventListener
public static void unregisterAWTEventListener(java.awt.event.AWTEventListener awtEventListener)
-
getAwtEventListeners
public static java.util.List<java.awt.event.AWTEventListener> getAwtEventListeners()
-
getBackgroundFill
public static java.awt.Color getBackgroundFill(RadianceSkin skin, RadianceThemingSlices.DecorationAreaType decorationAreaType)
-
getTextBackgroundFill
public static java.awt.Color getTextBackgroundFill(java.awt.Component component, ComponentState componentState)
-
getTextSelectionBackground
public static java.awt.Color getTextSelectionBackground(java.awt.Component component, ComponentState componentState)
-
getTextSelectionForeground
public static java.awt.Color getTextSelectionForeground(java.awt.Component component, ComponentState componentState)
-
-