org.jvnet.substance.utils
Class SubstanceCoreUtilities

java.lang.Object
  extended by org.jvnet.substance.utils.SubstanceCoreUtilities

public class SubstanceCoreUtilities
extends java.lang.Object

Various utility functions. This class is for internal use only.

Author:
Kirill Grouchnikov, Romain Guy

Method Summary
static java.awt.image.BufferedImage blendImagesHorizontal(java.awt.image.BufferedImage imageLeft, java.awt.image.BufferedImage imageRight, double start, double end)
          Blends two images along X-axis.
static java.awt.image.BufferedImage blendImagesVertical(java.awt.image.BufferedImage imageTop, java.awt.image.BufferedImage imageBottom, double start, double end)
          Blends two images along Y-axis.
static java.awt.image.BufferedImage blur(java.awt.image.BufferedImage src, int shadowSize)
          Blur the provided source image into a new image.
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 java.awt.image.BufferedImage createClipImage(java.awt.Shape s, int width, int height)
          Creates a clip image for soft-clipping.
static java.awt.image.BufferedImage createCompatibleImage(java.awt.image.BufferedImage image)
          Creates a compatible image (for efficient processing and drawing).
static javax.swing.Icon getActiveIcon(javax.swing.Icon origIcon, javax.swing.JComponent comp, javax.swing.ButtonModel model, javax.swing.Icon glowingIcon, boolean ignoreRolloverSetting)
           
static ColorScheme getActiveScheme(java.awt.Component component)
          Returns the active scheme of the specified component.
static ColorScheme getActiveScheme(java.awt.Component component, java.awt.Component parent)
          Returns the active scheme of the specified component in the specified parent.
static SubstanceTheme getActiveTheme(java.awt.Component component, boolean toReturnCurrent)
          Returns the active theme of the specified component.
static javax.swing.Icon getArrowIcon(java.awt.Component comp, javax.swing.AbstractButton button, int orientation)
          Returns the arrow icon.
static java.awt.image.BufferedImage getBlankImage(int width, int height)
          Retrieves transparent image of specified dimension.
static SubstanceBorderPainter getBorderPainter(java.awt.Component comp, SubstanceGradientPainter gradientPainter)
          Returns the border painter for the specified component.
static SubstanceButtonShaper getButtonShaper(javax.swing.AbstractButton button)
          Returns the button shaper of the specified button.
static java.lang.ClassLoader getClassLoaderForResources()
           
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 java.lang.Object getComboPopupPrototypeDisplayValue(javax.swing.JComboBox combo)
          Returns the popup prototype display value for the specified combo box.
static SubstanceTheme getComponentTheme(javax.swing.JComponent component, ComponentState.ColorSchemeKind colorSchemeKind)
          Returns the component theme.
static SubstanceTheme getComponentTheme(javax.swing.JComponent component, ComponentState.ColorSchemeKind colorSchemeKind, boolean checkHierarchy)
          Returns the component theme.
static SubstanceConstants.TabContentPaneBorderKind getContentBorderKind(javax.swing.JTabbedPane tabbedPane)
          Returns the content border kind of the specified tabbed pane.
static ControlBackgroundComposite getControlBackgroundComposite(java.awt.Component component)
          Returns the tab background composite of the specified tabbed pane.
static ColorScheme getDefaultScheme(java.awt.Component component)
          Returns the default scheme of the specified component.
static ColorScheme getDefaultScheme(java.awt.Component component, boolean toReturnCurrent)
          Returns the default scheme of the specified component.
static ColorScheme getDefaultScheme(java.awt.Component component, java.awt.Component parent)
          Returns the default scheme of the specified component in the specified parent.
static SubstanceTheme getDefaultTheme(java.awt.Component component, boolean toReturnCurrent)
          Returns the default theme of the specified component.
static SubstanceTheme getDefaultTheme(java.awt.Component component, boolean toReturnCurrent, boolean checkHierarchy)
          Returns the default theme of the specified component.
static ColorScheme getDisabledScheme(java.awt.Component component)
          Returns the disabled scheme of the specified component.
static ColorScheme getDisabledScheme(java.awt.Component component, boolean toReturnCurrent)
          Returns the disabled scheme of the specified component.
static ColorScheme getDisabledScheme(java.awt.Component component, java.awt.Component parent)
          Returns the disabled scheme of the specified component in the specified parent.
static SubstanceTheme getDisabledTheme(java.awt.Component component, boolean toReturnCurrent)
          Returns the disabled theme of the specified component.
static javax.swing.Icon getDoubleArrowIcon(java.awt.Component comp, javax.swing.AbstractButton button, int orientation)
          Returns the arrow icon.
static int getEchoPerChar(javax.swing.JPasswordField jpf)
          Returns the number of echo characters per each password chanaracter.
static org.jvnet.lafwidget.animation.FadeTrackerCallback getFadeCallback(javax.swing.AbstractButton button)
          Returns the fade callback for the specified button.
static org.jvnet.lafwidget.animation.FadeTrackerCallback getFadeCallback(javax.swing.JComponent component, javax.swing.ButtonModel model, boolean toIgnoreSelection)
          Returns the fade callback for the specified component.
static SubstanceConstants.FocusKind getFocusKind(java.awt.Component component)
          Returns the focus ring kind of the specified component.
static SubstanceGradientPainter getGradientPainter(javax.swing.JComponent comp)
          Returns the gradient painter of the specified component.
static GripPainter getGripPainter(javax.swing.JComponent component, GripPainter defaultPainter)
          Returns the grip painter for the specified component.
static java.awt.Container getHeaderParent(java.awt.Component c)
          Given a component, returns the parent for computing the SubstanceHeaderPainter.
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 float getHighlightAlpha(java.awt.Component component, ComponentState componentState, boolean toReturnCurrent)
          Returns the alpha channel of the highlight theme of the component.
static SubstanceTheme getHighlightTheme(java.awt.Component component, java.awt.Component parent, ComponentState componentState, boolean toReturnCurrent)
          Returns the highlight theme of the component.
static SubstanceTheme getHighlightTheme(java.awt.Component component, ComponentState componentState, boolean toReturnCurrent, boolean checkHierarchy)
          Returns the highlight theme of the component.
static javax.swing.Icon getIcon(javax.swing.AbstractButton b, javax.swing.Icon glowingIcon, boolean ignoreRolloverSetting)
          Returns the current icon for the specified button.
static javax.swing.Icon getIcon(java.lang.String iconResource)
          Returns an icon pointed to by the specified string.
static java.awt.Color getInterpolatedForegroundColor(java.awt.Component comp, java.lang.Comparable<?> componentId, SubstanceTheme theme, ComponentState state, ComponentState prevState, org.jvnet.lafwidget.animation.FadeKind... kinds)
          Returns the foreground color for the specified component.
static java.awt.Color getMarkColor(SubstanceTheme theme, boolean isEnabled)
          Returns the color of mark icons (checkbox, radio button, scrollbar arrows, combo arrows, menu arrows etc) for the specified theme.
static SubstanceConstants.MenuGutterFillKind getMenuGutterFillKind()
          Returns the global menu gutter fill kind.
static ColorScheme getOptionPaneColorScheme(int messageType, ColorScheme mainScheme)
          Returns the color scheme for the icon of option panes with the specified message type.
static int getPopupFlyoutOrientation(javax.swing.JComboBox combobox)
          Returns the popup flyout orientation for the specified combobox.
static ComponentState getPrevComponentState(javax.swing.JComponent comp)
          Returns the previous state of the specified component.
static ComponentState getPrevSelComponentState(javax.swing.JComponent comp)
          Returns the previous state of the specified component.
static java.util.ResourceBundle getResourceBundle(javax.swing.JComponent jcomp)
          Returns the resource bundle for the specified component.
static ColorScheme getScheme(java.awt.Component component, ComponentState componentState)
          Returns the color scheme of the component.
static java.lang.String getSchemeId(ColorScheme colorScheme)
          Retruns the unique ID for the specified color scheme.
static SubstanceConstants.ScrollPaneButtonPolicyKind getScrollPaneButtonsPolicyKind(javax.swing.JScrollBar scrollBar)
          Returns the scroll bar buttons kind of the specified scroll bar.
static java.util.Set<SubstanceConstants.Side> getSides(javax.swing.AbstractButton button, java.lang.String propertyName)
          Returns the set of sides registered on the specified button.
static TabCloseCallback getTabCloseCallback(java.awt.event.MouseEvent me, javax.swing.JTabbedPane tabbedPane, int tabIndex)
          Returns the callback to be called upon tab closing (using the tab close button).
static SubstanceConstants.TabTextAlignmentKind getTabTextAlignmentKind(javax.swing.JTabbedPane tabPane)
          Returns the text alignment kind of the specified tabbed pane.
static SubstanceTheme getTheme(java.awt.Component component, boolean toReturnCurrent)
          Returns the theme of the specified component.
static SubstanceTheme getTheme(java.awt.Component component, java.awt.Component parent, boolean toReturnCurrent)
          Returns the theme of the specified component in the specified parent.
static SubstanceTheme getTheme(java.awt.Component component, java.awt.Component parent, ComponentState componentState, boolean toReturnCurrent)
          Returns the theme of the component.
static SubstanceTheme getTheme(java.awt.Component component, ComponentState componentState, boolean toReturnCurrent, boolean checkHierarchy)
          Returns the theme of the component.
static SubstanceTitlePainter getTitlePainter(javax.swing.JInternalFrame jif)
          Returns the title painter of the specified internal frame.
static SubstanceTitlePainter getTitlePainter(javax.swing.JRootPane rp)
          Returns the title painter of the specified root pane.
static javax.swing.JComponent getTitlePane(javax.swing.JRootPane rootPane)
          Returns the title pane of the specified root pane.
static float getToolbarButtonCornerRadius(javax.swing.AbstractButton button, java.awt.Insets insets)
          Returns the corner radius of the specified toolbar button.
static boolean hasCloseButton(javax.swing.JTabbedPane tabbedPane, int tabIndex)
          Checks whether the specified tab has a close button.
static boolean hasFlatAppearance(javax.swing.AbstractButton button)
          Computes whether the specified button has flat appearance.
static boolean hasFlatAppearance(java.awt.Component comp, boolean defaultValue)
          Checks whether the specified component is flat.
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 hasOverlayProperty(java.awt.Component component)
          Checks whether the specified component has overlay enabled.
static boolean hasPropertySetTo(java.awt.Component comp, java.lang.String propertyName, boolean expectedValue, boolean checkHierarchy)
          Checks whether a component has the specified client property set to the specified value.
static boolean hasSubstanceBorder(javax.swing.JComponent c)
          Returns indication whether the specified component's border is a Substance-specific border.
static boolean hasText(javax.swing.AbstractButton button)
          Checks whether the specified button has associated text.
static boolean isButtonNeverPainted(javax.swing.AbstractButton button)
          Checks whether the specified button never paints its background.
static boolean isComboBoxButton(javax.swing.AbstractButton button)
          Checks and answers if the specified button is in a combo box.
static boolean isControlAlwaysPaintedActive(java.awt.Component comp)
          Checks whether the specified control is always painted in currently active color (ignoring the transition states that normally result in default appearance).
static boolean isControlAlwaysPaintedActive(java.awt.Component comp, boolean checkHierarchy)
          Checks whether the specified control is always painted in currently active color (ignoring the transition states that normally result in default appearance).
static boolean isInHeader(java.awt.Component c)
          Checks whether the specified component is inside a container painted by SubstanceHeaderPainter.
static boolean isInternalFrameModified(javax.swing.JInternalFrame internalFrame)
          Retrieves the modified state for the specified internal frame.
static boolean isRootPaneModified(javax.swing.JRootPane rootPane)
          Retrieves the modified state for the specified root pane.
static boolean isScrollBarButton(javax.swing.AbstractButton button)
          Checks and answers if the specified button is in a combo box.
static boolean isScrollButton(javax.swing.JComponent comp)
          Checks answers if the specified component is a button in a scroll control, such as scroll bar or tabbed pane (as tab scroller).
static boolean isSpinnerButton(javax.swing.AbstractButton button)
          Checks and answers if the specified button is in a spinner.
static boolean isTabModified(java.awt.Component tabComponent)
          Retrieves the modified state for the specified component in a tabbed pane.
static boolean isThemeDark(SubstanceTheme theme)
          Checks whether the specified theme is dark.
static boolean isTitleCloseButton(javax.swing.AbstractButton ab)
          Returns indication whether the specified button is a close button on some title pane.
static boolean isToolBarButton(javax.swing.AbstractButton button)
          Checks and answers if the specified button is in a toolbar.
static void makeNonDoubleBuffered(java.awt.Component comp, java.util.Map<java.awt.Component,java.lang.Boolean> dbSnapshot)
          Makes the specified component and all its descendants non-double buffered.
static void makeNonOpaque(java.awt.Component comp, java.util.Map<java.awt.Component,java.lang.Boolean> opaquenessSnapshot)
          Makes the specified component and all its descendants non-opaque.
static void paintFocus(java.awt.Graphics g, java.awt.Component mainComp, java.awt.Component focusedComp, java.awt.Rectangle textRect)
          Paints the focus ring on the specified component.
static void paintFocus(java.awt.Graphics g, java.awt.Component mainComp, java.awt.Component focusedComp, java.awt.Rectangle focusRect, java.awt.Rectangle textRect, float maxAlphaCoef, int extraPadding)
          Paints the focus ring on the specified component.
static void paintMenuText(javax.swing.JMenuItem menuItem, java.awt.Graphics g, java.lang.String text, java.awt.Rectangle textRect)
          Paints menu text.
static void paintSeparator(java.awt.Component c, java.awt.Graphics2D graphics, ColorScheme colorScheme, boolean isDark, int width, int height, int orientation)
          Paints a separator.
static void paintSeparator(java.awt.Component c, java.awt.Graphics2D graphics, ColorScheme colorScheme, boolean isDark, int width, int height, int orientation, boolean hasShadow, int maxGradLength)
          Paints a separator.
static void paintSeparator(java.awt.Component c, java.awt.Graphics2D graphics, ColorScheme colorScheme, boolean isDark, int width, int height, int orientation, boolean hasShadow, int maxGradLengthStart, int maxGradLengthEnd)
          Paints a separator.
static void paintText(java.awt.Graphics g, javax.swing.AbstractButton button, java.awt.Rectangle textRect, java.lang.String text, int textShiftOffset, java.lang.String propertyPrefix)
          Paints the text with the specified parameters.
static void paintTextWithDropShadow(java.awt.Component c, java.awt.Graphics g, java.awt.Color foregroundColor, java.lang.String text, int width, int height, int xOffset, int yOffset)
          Paints text with drop shadow.
static void resetCaches()
           
static void resetMenuBars(java.awt.Component component)
          Resets the menu bars on the specified component.
static void restoreDoubleBuffered(java.awt.Component comp, java.util.Map<java.awt.Component,java.lang.Boolean> dbSnapshot)
          Restores the double buffer of the specified component and all its descendants.
static void restoreOpaque(java.awt.Component comp, java.util.Map<java.awt.Component,java.lang.Boolean> opaquenessSnapshot)
          Restores the opacity of the specified component and all its descendants.
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 toBleedWatermark(java.awt.Component component)
          Returns indication whether the watermark should "bleed" through the specified component.
static boolean toDrawWatermark(java.awt.Component component)
          Returns indication whether the watermark should be drawn on the specified component.
static boolean toLayoutVertically(javax.swing.JTabbedPane tabbedPane)
          Checks whether the specified tab should show vertically-aligned (rotated) components.
static boolean toShowExtraElements(java.awt.Component component)
          Checks whether the specified component has extra Substance-specific UI elements.
static boolean toShowIconUnrotated(javax.swing.JTabbedPane tabbedPane, int tabIndex)
          Checks whether the specified tab should show unrotated icon when the tab itself is layed-out vertically.
static void uninstallMenu(javax.swing.JMenuItem menuItem)
          Uninstalls the specified menu item.
static boolean useThemedDefaultIcon(javax.swing.JComponent comp)
          Checks whether the specified component will show theme-colorized icon in the default state.
static void workaroundBug6576507(java.awt.Graphics graphics)
          Provides workaround for bug 6576507.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 origianl 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 origianl 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, otherwise false.

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, otherwise false.

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 tool bar, false otherwise

isScrollBarButton

public static boolean isScrollBarButton(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 tool bar, false otherwise

isSpinnerButton

public static boolean isSpinnerButton(javax.swing.AbstractButton button)
Checks and answers if the specified button is in a spinner.

Parameters:
button - the button to check
Returns:
true if in spinner, false otherwise

isToolBarButton

public static boolean isToolBarButton(javax.swing.AbstractButton button)
Checks and answers if the specified button is in a toolbar.

Parameters:
button - the button to check
Returns:
true if in toolbar, false otherwise

isScrollButton

public static boolean isScrollButton(javax.swing.JComponent comp)
Checks answers if the specified component is a button in a scroll control, such as scroll bar or tabbed pane (as tab scroller).

Parameters:
comp - The component to check
Returns:
true if the specified component is a button in a scroll control, false otherwise

getTheme

public static SubstanceTheme getTheme(java.awt.Component component,
                                      boolean toReturnCurrent)
Returns the theme of the specified component.

Parameters:
component - The component.
toReturnCurrent - if true, the currently set Substance theme will be returned if the SubstanceLookAndFeel.THEME_PROPERTY is not set on the component and any of its ancestors.
Returns:
The theme of the specified component.

getTheme

public static SubstanceTheme getTheme(java.awt.Component component,
                                      java.awt.Component parent,
                                      boolean toReturnCurrent)
Returns the theme of the specified component in the specified parent.

Parameters:
component - The component.
parent - The component parent of the component.
toReturnCurrent - if true, the currently set Substance theme will be returned if the SubstanceLookAndFeel.THEME_PROPERTY is not set on the component and any of its ancestors.
Returns:
The theme of the specified component.

getActiveTheme

public static SubstanceTheme getActiveTheme(java.awt.Component component,
                                            boolean toReturnCurrent)
Returns the active theme of the specified component.

Parameters:
component - The component.
toReturnCurrent - if true, the currently set Substance theme will be returned if the SubstanceLookAndFeel.THEME_PROPERTY is not set on the component and any of its ancestors.
Returns:
The active theme of the specified component.

getDefaultTheme

public static SubstanceTheme getDefaultTheme(java.awt.Component component,
                                             boolean toReturnCurrent)
Returns the default theme of the specified component.

Parameters:
component - The component.
toReturnCurrent - if true, the currently set Substance theme will be returned if the SubstanceLookAndFeel.THEME_PROPERTY is not set on the component and any of its ancestors.
Returns:
The default theme of the specified component.

getDefaultTheme

public static SubstanceTheme getDefaultTheme(java.awt.Component component,
                                             boolean toReturnCurrent,
                                             boolean checkHierarchy)
Returns the default theme of the specified component.

Parameters:
component - The component.
toReturnCurrent - if true, the currently set Substance theme will be returned if the SubstanceLookAndFeel.THEME_PROPERTY is not set on the component and any of its ancestors.
checkHierarchy - If true, the entire component hierarchy will be scanned for the SubstanceLookAndFeel.PAINT_ACTIVE_PROPERTY.
Returns:
The default theme of the specified component.

getTheme

public static SubstanceTheme getTheme(java.awt.Component component,
                                      java.awt.Component parent,
                                      ComponentState componentState,
                                      boolean toReturnCurrent)
Returns the theme of the component.

Parameters:
component - Component.
parent - Component parent.
componentState - Component state.
toReturnCurrent - if true, the currently set Substance theme will be returned if the SubstanceLookAndFeel.THEME_PROPERTY is not set on the component and any of its ancestors.
Returns:
Component theme.

getHighlightTheme

public static SubstanceTheme getHighlightTheme(java.awt.Component component,
                                               java.awt.Component parent,
                                               ComponentState componentState,
                                               boolean toReturnCurrent)
Returns the highlight theme of the component.

Parameters:
component - Component.
parent - Component parent.
componentState - Component state.
toReturnCurrent - if true, the currently set Substance theme will be returned if the SubstanceLookAndFeel.THEME_PROPERTY is not set on the component and any of its ancestors.
Returns:
Component highlight theme.

getTheme

public static SubstanceTheme getTheme(java.awt.Component component,
                                      ComponentState componentState,
                                      boolean toReturnCurrent,
                                      boolean checkHierarchy)
Returns the theme of the component.

Parameters:
component - Component.
componentState - Component state.
toReturnCurrent - if true, the currently set Substance theme will be returned if the SubstanceLookAndFeel.THEME_PROPERTY is not set on the component and any of its ancestors.
checkHierarchy - If true, the entire component hierarchy will be scanned for the SubstanceLookAndFeel.PAINT_ACTIVE_PROPERTY.
Returns:
Component theme.

getHighlightTheme

public static SubstanceTheme getHighlightTheme(java.awt.Component component,
                                               ComponentState componentState,
                                               boolean toReturnCurrent,
                                               boolean checkHierarchy)
Returns the highlight theme of the component.

Parameters:
component - Component.
componentState - Component state.
toReturnCurrent - if true, the currently set Substance theme will be returned if the SubstanceLookAndFeel.THEME_PROPERTY is not set on the component and any of its ancestors.
checkHierarchy - If true, the entire component hierarchy will be scanned for the SubstanceLookAndFeel.PAINT_ACTIVE_PROPERTY.
Returns:
Component highlight theme.

getHighlightAlpha

public static float getHighlightAlpha(java.awt.Component component,
                                      ComponentState componentState,
                                      boolean toReturnCurrent)
Returns the alpha channel of the highlight theme of the component.

Parameters:
component - Component.
componentState - Component state.
toReturnCurrent - if true, the currently set Substance theme will be returned if the SubstanceLookAndFeel.THEME_PROPERTY is not set on the component and any of its ancestors.
Returns:
Highlight theme alpha channel.

getDisabledTheme

public static SubstanceTheme getDisabledTheme(java.awt.Component component,
                                              boolean toReturnCurrent)
Returns the disabled theme of the specified component.

Parameters:
component - The component.
toReturnCurrent - if true, the currently set Substance theme will be returned if the SubstanceLookAndFeel.THEME_PROPERTY is not set on the component and any of its ancestors.
Returns:
The disabled theme of the specified component.

getScheme

public static ColorScheme getScheme(java.awt.Component component,
                                    ComponentState componentState)
Returns the color scheme of the component.

Parameters:
component - Component.
componentState - Component state.
Returns:
Component color scheme.

getActiveScheme

public static ColorScheme getActiveScheme(java.awt.Component component)
Returns the active scheme of the specified component.

Parameters:
component - The component.
Returns:
The active scheme of the specified component.

getDefaultScheme

public static ColorScheme getDefaultScheme(java.awt.Component component,
                                           boolean toReturnCurrent)
Returns the default scheme of the specified component.

Parameters:
component - The component.
toReturnCurrent - if true, the currently set Substance theme will be returned if the SubstanceLookAndFeel.THEME_PROPERTY is not set on the component and any of its ancestors.
Returns:
The default scheme of the specified component.

getDefaultScheme

public static ColorScheme getDefaultScheme(java.awt.Component component)
Returns the default scheme of the specified component.

Parameters:
component - The component.
Returns:
The default scheme of the specified component.

getDisabledScheme

public static ColorScheme getDisabledScheme(java.awt.Component component,
                                            boolean toReturnCurrent)
Returns the disabled scheme of the specified component.

Parameters:
component - The component.
toReturnCurrent - if true, the currently set Substance theme will be returned if the SubstanceLookAndFeel.THEME_PROPERTY is not set on the component and any of its ancestors.
Returns:
The disabled scheme of the specified component.

getDisabledScheme

public static ColorScheme getDisabledScheme(java.awt.Component component)
Returns the disabled scheme of the specified component.

Parameters:
component - The component.
Returns:
The disabled scheme of the specified component.

getActiveScheme

public static ColorScheme getActiveScheme(java.awt.Component component,
                                          java.awt.Component parent)
Returns the active scheme of the specified component in the specified parent.

Parameters:
component - The component.
parent - The component parent of the component.
Returns:
The active scheme of the specified component.

getDefaultScheme

public static ColorScheme getDefaultScheme(java.awt.Component component,
                                           java.awt.Component parent)
Returns the default scheme of the specified component in the specified parent.

Parameters:
component - The component.
parent - The component parent of the component.
Returns:
The default scheme of the specified component.

getDisabledScheme

public static ColorScheme getDisabledScheme(java.awt.Component component,
                                            java.awt.Component parent)
Returns the disabled scheme of the specified component in the specified parent.

Parameters:
component - The component.
parent - The component parent of the component.
Returns:
The disabled scheme of the specified component.

isControlAlwaysPaintedActive

public static boolean isControlAlwaysPaintedActive(java.awt.Component comp)
Checks whether the specified control is always painted in currently active color (ignoring the transition states that normally result in default appearance).

Parameters:
comp - Control.
Returns:
true if the specified control is always painted in currently active color (ignoring the transition states that normally result in default appearance), false otherwise.

isControlAlwaysPaintedActive

public static boolean isControlAlwaysPaintedActive(java.awt.Component comp,
                                                   boolean checkHierarchy)
Checks whether the specified control is always painted in currently active color (ignoring the transition states that normally result in default appearance).

Parameters:
comp - Control.
checkHierarchy - If true, the entire component hierarchy will be scanned for the SubstanceLookAndFeel.PAINT_ACTIVE_PROPERTY.
Returns:
true if the specified control is always painted in currently active color (ignoring the transition states that normally result in default appearance), false otherwise.

isButtonNeverPainted

public static boolean isButtonNeverPainted(javax.swing.AbstractButton button)
Checks whether the specified button never paints its background.

Parameters:
button - Button.
Returns:
true if the specified button never paints its background, false otherwise.

getFocusKind

public static SubstanceConstants.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.

getTabTextAlignmentKind

public static SubstanceConstants.TabTextAlignmentKind getTabTextAlignmentKind(javax.swing.JTabbedPane tabPane)
Returns the text alignment kind of the specified tabbed pane.

Parameters:
tabPane - Tabbed pane.
Returns:
The text alignment kind of the specified tabbed pane.

toDrawWatermark

public static boolean toDrawWatermark(java.awt.Component component)
Returns indication whether the watermark should be drawn on the specified component.

Parameters:
component - Component.
Returns:
true if the watermark should be drawn on the specified component, false otherwise.

toBleedWatermark

public static boolean toBleedWatermark(java.awt.Component component)
Returns indication whether the watermark should "bleed" through the specified component.

Parameters:
component - Component.
Returns:
true if the watermark should "bleed" through the specified component, false otherwise.

getButtonShaper

public static SubstanceButtonShaper getButtonShaper(javax.swing.AbstractButton button)
Returns the button shaper of the specified button.

Parameters:
button - The button.
Returns:
The button shaper of the specified button.

getGradientPainter

public static SubstanceGradientPainter getGradientPainter(javax.swing.JComponent comp)
Returns the gradient painter of the specified component.

Parameters:
comp - Component.
Returns:
The gradient painter of the specified component.

isTabModified

public static boolean isTabModified(java.awt.Component tabComponent)
Retrieves the modified 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:
SubstanceLookAndFeel.WINDOW_MODIFIED

isRootPaneModified

public static boolean isRootPaneModified(javax.swing.JRootPane rootPane)
Retrieves the modified 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:
SubstanceLookAndFeel.WINDOW_MODIFIED

isInternalFrameModified

public static boolean isInternalFrameModified(javax.swing.JInternalFrame internalFrame)
Retrieves the modified state for the specified internal frame.

Parameters:
internalFrame - The internal frame.
Returns:
true if the specified internal frame is marked as modified, false otherwise.
See Also:
SubstanceLookAndFeel.WINDOW_MODIFIED

getControlBackgroundComposite

public static ControlBackgroundComposite getControlBackgroundComposite(java.awt.Component component)
Returns the tab background composite of the specified tabbed pane.

Parameters:
component - Tabbed pane.
Returns:
Tab background composite of the specified tabbed pane.

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.

toLayoutVertically

public static boolean toLayoutVertically(javax.swing.JTabbedPane tabbedPane)
Checks whether the specified tab should show vertically-aligned (rotated) components.

Parameters:
tabbedPane - Tabbed pane.
Returns:
true if the specified tab should show vertically-aligned (rotated) components, false otherwise.

toShowIconUnrotated

public static boolean toShowIconUnrotated(javax.swing.JTabbedPane tabbedPane,
                                          int tabIndex)
Checks whether the specified tab should show unrotated icon when the tab itself is layed-out vertically.

Parameters:
tabbedPane - Tabbed pane.
tabIndex - Tab index.
Returns:
true if the specified tab should show unrotated icon when the tab itself is layed-out vertically, false otherwise.

getContentBorderKind

public static SubstanceConstants.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.

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(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.

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 if there is no SubstanceLookAndFeel.FLAT_PROPERTY defined on button hierarchy or UIManager.
Returns:
false if the specified button is flat, true otherwise.

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.

getPopupFlyoutOrientation

public static int getPopupFlyoutOrientation(javax.swing.JComboBox combobox)
Returns the popup flyout orientation for the specified combobox.

Parameters:
combobox - Combobox.
Returns:
The popup flyout orientation for the specified combobox.

makeNonOpaque

public static void makeNonOpaque(java.awt.Component comp,
                                 java.util.Map<java.awt.Component,java.lang.Boolean> opaquenessSnapshot)
Makes the specified component and all its descendants non-opaque.

Parameters:
comp - Component.
opaquenessSnapshot - 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> opaquenessSnapshot)
Restores the opacity of the specified component and all its descendants.

Parameters:
comp - Component.
opaquenessSnapshot - The "snapshot" map that contains the original opacity status of the specified component and all its descendants.

makeNonDoubleBuffered

public static void makeNonDoubleBuffered(java.awt.Component comp,
                                         java.util.Map<java.awt.Component,java.lang.Boolean> dbSnapshot)
Makes the specified component and all its descendants non-double buffered.

Parameters:
comp - Component.
dbSnapshot - The "snapshot" map that will contain the original double buffer status of the specified component and all its descendants.

restoreDoubleBuffered

public static void restoreDoubleBuffered(java.awt.Component comp,
                                         java.util.Map<java.awt.Component,java.lang.Boolean> dbSnapshot)
Restores the double buffer of the specified component and all its descendants.

Parameters:
comp - Component.
dbSnapshot - The "snapshot" map that contains the original double buffer status of the specified component and all its descendants.

createCompatibleImage

public static java.awt.image.BufferedImage createCompatibleImage(java.awt.image.BufferedImage image)
Creates a compatible image (for efficient processing and drawing).

Parameters:
image - The original image.
Returns:
Compatible version of the original image.

useThemedDefaultIcon

public static boolean useThemedDefaultIcon(javax.swing.JComponent comp)
Checks whether the specified component will show theme-colorized icon in the default state.

Parameters:
comp - Component.
Returns:
true if the specified component will show theme-colorized icon in the default state, false otherwise.

getTabCloseCallback

public static TabCloseCallback getTabCloseCallback(java.awt.event.MouseEvent me,
                                                   javax.swing.JTabbedPane tabbedPane,
                                                   int tabIndex)
Returns the callback to be called upon tab closing (using the tab close button).

Parameters:
me - Mouse event.
tabbedPane - Tabbed pane.
tabIndex - Tab index.
Returns:
Callback to be called upon tab closing (using the tab close button).

blendImagesHorizontal

public static java.awt.image.BufferedImage blendImagesHorizontal(java.awt.image.BufferedImage imageLeft,
                                                                 java.awt.image.BufferedImage imageRight,
                                                                 double start,
                                                                 double end)
Blends two images along X-axis.

Parameters:
imageLeft - The left image.
imageRight - The right image.
start - Relative start of the blend area (in 0.0-1.0 range).
end - Relative end of the blend area (in 0.0-1.0 range).
Returns:
Blended image.

blendImagesVertical

public static java.awt.image.BufferedImage blendImagesVertical(java.awt.image.BufferedImage imageTop,
                                                               java.awt.image.BufferedImage imageBottom,
                                                               double start,
                                                               double end)
Blends two images along Y-axis.

Parameters:
imageTop - The left image.
imageBottom - The right image.
start - Relative start of the blend area (in 0.0-1.0 range).
end - Relative end of the blend area (in 0.0-1.0 range).
Returns:
Blended image.

getSchemeId

public static java.lang.String getSchemeId(ColorScheme colorScheme)
Retruns the unique ID for the specified color scheme.

Parameters:
colorScheme - Color scheme.
Returns:
Unique ID for the specified color scheme.

getOptionPaneColorScheme

public static ColorScheme getOptionPaneColorScheme(int messageType,
                                                   ColorScheme mainScheme)
Returns the color scheme for the icon of option panes with the specified message type.

Parameters:
messageType - Option pane message type.
mainScheme - Main color scheme.
Returns:
Color scheme for the icon of option panes with the specified message type.

isThemeDark

public static boolean isThemeDark(SubstanceTheme theme)
Checks whether the specified theme is dark.

Parameters:
theme - Theme.
Returns:
true if the specified theme is dark, false otherwise.

getComponentTheme

public static SubstanceTheme getComponentTheme(javax.swing.JComponent component,
                                               ComponentState.ColorSchemeKind colorSchemeKind)
Returns the component theme.

Parameters:
component - Component.
colorSchemeKind - Color scheme kind.
Returns:
Component theme.

getComponentTheme

public static SubstanceTheme getComponentTheme(javax.swing.JComponent component,
                                               ComponentState.ColorSchemeKind colorSchemeKind,
                                               boolean checkHierarchy)
Returns the component theme.

Parameters:
component - Component.
colorSchemeKind - Color scheme kind.
checkHierarchy - If true, the entire component hierarchy will be scanned for the SubstanceLookAndFeel.PAINT_ACTIVE_PROPERTY.
Returns:
Component theme.

getComboPopupPrototypeDisplayValue

public static java.lang.Object getComboPopupPrototypeDisplayValue(javax.swing.JComboBox 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.

getTitlePainter

public static SubstanceTitlePainter getTitlePainter(javax.swing.JRootPane rp)
Returns the title painter of the specified root pane.

Parameters:
rp - Root pane.
Returns:
The title painter of the specified root pane.

getTitlePainter

public static SubstanceTitlePainter getTitlePainter(javax.swing.JInternalFrame jif)
Returns the title painter of the specified internal frame.

Parameters:
jif - Internal frame.
Returns:
The title painter of the specified internal frame.

getScrollPaneButtonsPolicyKind

public static SubstanceConstants.ScrollPaneButtonPolicyKind getScrollPaneButtonsPolicyKind(javax.swing.JScrollBar scrollBar)
Returns the scroll bar buttons kind of the specified scroll bar.

Parameters:
scrollBar - Scroll bar.
Returns:
The scroll bar buttons kind of the specified scroll bar.

getSides

public static java.util.Set<SubstanceConstants.Side> getSides(javax.swing.AbstractButton button,
                                                              java.lang.String propertyName)
Returns the set of sides registered on the specified button.

Parameters:
button - 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.AbstractButton button,
                                                 java.awt.Insets 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.

getEchoPerChar

public static int getEchoPerChar(javax.swing.JPasswordField jpf)
Returns the number of echo characters per each password chanaracter.

Parameters:
jpf - Password field.
Returns:
The number of echo characters per each password chanaracter.

createClipImage

public static java.awt.image.BufferedImage createClipImage(java.awt.Shape s,
                                                           int width,
                                                           int height)
Creates a clip image for soft-clipping. Code taken from here.

Parameters:
s - Clip shape.
width - Image width.
height - Image height.
Returns:
Clip image.

getMarkColor

public static java.awt.Color getMarkColor(SubstanceTheme theme,
                                          boolean isEnabled)
Returns the color of mark icons (checkbox, radio button, scrollbar arrows, combo arrows, menu arrows etc) for the specified theme.

Parameters:
theme - Theme.
isEnabled - If true, the mark should be painted in enabled state.
Returns:
Color of mark icons.

hasOverlayProperty

public static boolean hasOverlayProperty(java.awt.Component component)
Checks whether the specified component has overlay enabled.

Parameters:
component - Component.
Returns:
true if the specified component has overlay enabled, false otherwise.

toShowExtraElements

public static boolean toShowExtraElements(java.awt.Component component)
Checks whether the specified component has extra Substance-specific UI elements.

Parameters:
component - Component.
Returns:
true if the specified component has extra Substance-specific UI elements, false otherwise.

getGripPainter

public static GripPainter getGripPainter(javax.swing.JComponent component,
                                         GripPainter defaultPainter)
Returns the grip painter for the specified component.

Parameters:
component - Component.
defaultPainter - Default painter to use if no custom grip painter is specified.
Returns:
The grip painter for the specified component.

hasSubstanceBorder

public static boolean hasSubstanceBorder(javax.swing.JComponent c)
Returns indication whether the specified component's border is a Substance-specific border.

Parameters:
c - Component.
Returns:
true if the specified component's border is a Substance-specific border, false otherwise.

getActiveIcon

public static javax.swing.Icon getActiveIcon(javax.swing.Icon origIcon,
                                             javax.swing.JComponent comp,
                                             javax.swing.ButtonModel model,
                                             javax.swing.Icon glowingIcon,
                                             boolean ignoreRolloverSetting)

getIcon

public static javax.swing.Icon getIcon(javax.swing.AbstractButton b,
                                       javax.swing.Icon glowingIcon,
                                       boolean ignoreRolloverSetting)
Returns the current icon for the specified button. This method is for internal use only.

Parameters:
b - Button.
glowingIcon - The glowing icon.
ignoreRolloverSetting - If true, the rollover status of the specified button is ignored.
Returns:
Icon for the specified button.

getMenuGutterFillKind

public static SubstanceConstants.MenuGutterFillKind getMenuGutterFillKind()
Returns the global menu gutter fill kind.

Returns:
The global menu gutter fill kind.

getHeaderParent

public static java.awt.Container getHeaderParent(java.awt.Component c)
Given a component, returns the parent for computing the SubstanceHeaderPainter.

Parameters:
c - Component.
Returns:
The parent for computing the SubstanceHeaderPainter.

isInHeader

public static boolean isInHeader(java.awt.Component c)
Checks whether the specified component is inside a container painted by SubstanceHeaderPainter.

Parameters:
c - Component.
Returns:
true, if the specified component is inside a container painted by SubstanceHeaderPainter, false otherwise.

paintText

public static void paintText(java.awt.Graphics g,
                             javax.swing.AbstractButton button,
                             java.awt.Rectangle textRect,
                             java.lang.String text,
                             int textShiftOffset,
                             java.lang.String propertyPrefix)
Paints the text with the specified parameters.

Parameters:
g - Graphics context.
button - Button.
textRect - Text rectangle.
text - Text to paint.
textShiftOffset - Text shift offset.
propertyPrefix - Property prefix - used for computing the color of text on disabled buttons.

paintMenuText

public static void paintMenuText(javax.swing.JMenuItem menuItem,
                                 java.awt.Graphics g,
                                 java.lang.String text,
                                 java.awt.Rectangle textRect)
Paints menu text.

Parameters:
menuItem - Menu item.
g - Graphics context.
text - Text to paint.
textRect - Text rectangle.

paintFocus

public static void paintFocus(java.awt.Graphics g,
                              java.awt.Component mainComp,
                              java.awt.Component focusedComp,
                              java.awt.Rectangle focusRect,
                              java.awt.Rectangle textRect,
                              float maxAlphaCoef,
                              int extraPadding)
Paints the focus ring on the specified component.

Parameters:
g - Graphics context.
mainComp - The main component for the focus painting.
focusedComp - The actual component that has the focus. For example, the main component can be a JSpinner, while the focused component is a text field inside the the spinner editor.
focusRect - Focus rectangle. May be null - in this case, the bounds of mainComp will be used.
textRect - Text rectangle (if relevant).
maxAlphaCoef - Maximum alhpa coefficient for painting the focus. Values lower than 1.0 will result in a translucent focus ring (can be used to paint a focus ring that doesn't draw too much attention away from the content, for example on text components).
extraPadding - Extra padding between the component bounds and the focus ring painting.

paintFocus

public static void paintFocus(java.awt.Graphics g,
                              java.awt.Component mainComp,
                              java.awt.Component focusedComp,
                              java.awt.Rectangle textRect)
Paints the focus ring on the specified component.

Parameters:
g - Graphics context.
mainComp - The main component for the focus painting.
focusedComp - The actual component that has the focus. For example, the main component can be a JSpinner, while the focused component is a text field inside the the spinner editor.
textRect - Text rectangle (if relevant).

paintSeparator

public static void paintSeparator(java.awt.Component c,
                                  java.awt.Graphics2D graphics,
                                  ColorScheme colorScheme,
                                  boolean isDark,
                                  int width,
                                  int height,
                                  int orientation)
Paints a separator.

Parameters:
c - Component.
graphics - Graphics context.
colorScheme - Color scheme.
isDark - Indication whether the color scheme is dark.
width - Separator width.
height - Separator height.
orientation - Separator orientation.

paintSeparator

public static void paintSeparator(java.awt.Component c,
                                  java.awt.Graphics2D graphics,
                                  ColorScheme colorScheme,
                                  boolean isDark,
                                  int width,
                                  int height,
                                  int orientation,
                                  boolean hasShadow,
                                  int maxGradLength)
Paints a separator.

Parameters:
c - Component.
graphics - Graphics context.
colorScheme - Color scheme.
isDark - Indication whether the color scheme is dark.
width - Separator width.
height - Separator height.
orientation - Separator orientation.
hasShadow - If true, the separator painting will have shadow.
maxGradLength - Specifies the maximum pixel length of "ramp" portions of the separator. The ramp portions are located on separator ends and allow providing a faded appearance on those ends.

paintSeparator

public static void paintSeparator(java.awt.Component c,
                                  java.awt.Graphics2D graphics,
                                  ColorScheme colorScheme,
                                  boolean isDark,
                                  int width,
                                  int height,
                                  int orientation,
                                  boolean hasShadow,
                                  int maxGradLengthStart,
                                  int maxGradLengthEnd)
Paints a separator.

Parameters:
c - Component.
graphics - Graphics context.
colorScheme - Color scheme.
isDark - Indication whether the color scheme is dark.
width - Separator width.
height - Separator height.
orientation - Separator orientation.
hasShadow - If true, the separator painting will have shadow.
maxGradLengthStart - Specifies the maximum pixel length of the starting "ramp" portion of the separator. The starting ramp portion is located on top / left separator end and allows providing a faded appearance on that end.
maxGradLengthEnd - Specifies the maximum pixel length of the ending "ramp" portion of the separator. The ending ramp portion is located on bottom / right separator end and allows providing a faded appearance on that end.

blur

public static java.awt.image.BufferedImage blur(java.awt.image.BufferedImage src,
                                                int shadowSize)
Blur the provided source image into a new image. Note that the resulting image will be bigger than the original one.

Parameters:
src - source image
shadowSize - blur size
Returns:
an image containing the blurred source image

isTitleCloseButton

public static boolean isTitleCloseButton(javax.swing.AbstractButton ab)
Returns indication whether the specified button is a close button on some title pane.

Parameters:
ab - Button.
Returns:
true if the specified button is a close button on some title pane, false otherwise.

uninstallMenu

public static void uninstallMenu(javax.swing.JMenuItem menuItem)
Uninstalls the specified menu item.

Parameters:
menuItem - Menu item.

getIcon

public static javax.swing.Icon getIcon(java.lang.String iconResource)
Returns an icon pointed to by the specified string.

Parameters:
iconResource - Resource location string.
Returns:
Icon.

getClassLoaderForResources

public static java.lang.ClassLoader getClassLoaderForResources()

getFadeCallback

public static org.jvnet.lafwidget.animation.FadeTrackerCallback getFadeCallback(javax.swing.AbstractButton button)
Returns the fade callback for the specified button.

Parameters:
button - Button.
Returns:
Fade callback for the specified button.

getFadeCallback

public static org.jvnet.lafwidget.animation.FadeTrackerCallback getFadeCallback(javax.swing.JComponent component,
                                                                                javax.swing.ButtonModel model,
                                                                                boolean toIgnoreSelection)
Returns the fade callback for the specified component.

Parameters:
component - Component.
model - Model for tracking the transitions. For button components, pass the AbstractButton.getModel(), for other controls pass a dummy (synthesized) model.
toIgnoreSelection - If true, the ButtonModel.isSelected() will not be checked. This can be used for tracking transitions on menu items that use armed state instead, when we don't want to use different rollover themes for selected and unselected checkbox and radio button menu items (to preserve consistent visual appearence of highlights).
Returns:
Fade callback for the specified component.

getPrevComponentState

public static ComponentState getPrevComponentState(javax.swing.JComponent comp)
Returns the previous state of the specified component.

Parameters:
comp - Component.
Returns:
The previous state of the specified component.

getPrevSelComponentState

public static ComponentState getPrevSelComponentState(javax.swing.JComponent comp)
Returns the previous state of the specified component.

Parameters:
comp - Component.
Returns:
The previous state of the specified component.

hasPropertySetTo

public static boolean hasPropertySetTo(java.awt.Component comp,
                                       java.lang.String propertyName,
                                       boolean expectedValue,
                                       boolean checkHierarchy)
Checks whether a component has the specified client property set to the specified value.

Parameters:
comp - Component.
propertyName - Client property name.
expectedValue - Expected value.
checkHierarchy - if true, the entire component hierarchy is traversed.
Returns:
true if the component has the specified client property set to the specified value, false otherwise.

getResourceBundle

public static java.util.ResourceBundle getResourceBundle(javax.swing.JComponent jcomp)
Returns the resource bundle for the specified component.

Parameters:
jcomp - Component.
Returns:
Resource bundle for the specified component.

getBorderPainter

public static SubstanceBorderPainter getBorderPainter(java.awt.Component comp,
                                                      SubstanceGradientPainter gradientPainter)
Returns the border painter for the specified component.

Parameters:
comp - Component.
gradientPainter - Gradient painter for the specified component.
Returns:
Border painter for the specified component.

resetMenuBars

public static void resetMenuBars(java.awt.Component component)
Resets the menu bars on the specified component.

Parameters:
component - Component.

getInterpolatedForegroundColor

public static java.awt.Color getInterpolatedForegroundColor(java.awt.Component comp,
                                                            java.lang.Comparable<?> componentId,
                                                            SubstanceTheme theme,
                                                            ComponentState state,
                                                            ComponentState prevState,
                                                            org.jvnet.lafwidget.animation.FadeKind... kinds)
Returns the foreground color for the specified component.

Parameters:
comp - Component.
componentId - Optional component ID. Can be used to differentiate sub-parts of the component, such as tabs in tabbed pane, cells in list etc.
theme - Component theme.
state - Component current state.
prevState - Component previous state.
kinds - Animation kinds to consult for computing the foreground color.
Returns:
Foreground color.

paintTextWithDropShadow

public static void paintTextWithDropShadow(java.awt.Component c,
                                           java.awt.Graphics g,
                                           java.awt.Color foregroundColor,
                                           java.lang.String text,
                                           int width,
                                           int height,
                                           int xOffset,
                                           int yOffset)
Paints text with drop shadow.

Parameters:
c - Component.
g - Graphics context.
foregroundColor - Foreground color.
text - Text to paint.
width - Text rectangle width.
height - Text rectangle height.
xOffset - Text rectangle X offset.
yOffset - Text rectangle Y offset.

workaroundBug6576507

public static void workaroundBug6576507(java.awt.Graphics graphics)
Provides workaround for bug 6576507. This is especially relevant for skins that use translucent themes, such as AutumnSkin and MagmaSkin.

Parameters:
graphics - Graphics context.

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.

getTitlePane

public static javax.swing.JComponent getTitlePane(javax.swing.JRootPane rootPane)
Returns the title pane of the specified root pane.

Parameters:
rootPane - Root pane.
Returns:
The title pane of the specified root pane.

resetCaches

public static void resetCaches()

getArrowIcon

public static javax.swing.Icon getArrowIcon(java.awt.Component comp,
                                            javax.swing.AbstractButton button,
                                            int orientation)
Returns the arrow icon.

Parameters:
comp - Component.
button - Button.
orientation - Arrow orientation.
Returns:
Arrow icon.

getDoubleArrowIcon

public static javax.swing.Icon getDoubleArrowIcon(java.awt.Component comp,
                                                  javax.swing.AbstractButton button,
                                                  int orientation)
Returns the arrow icon.

Parameters:
comp - Component.
button - Button.
orientation - Arrow orientation.
Returns:
Arrow icon.