Class SubstanceCoreUtilities
- java.lang.Object
-
- org.pushingpixels.substance.internal.utils.SubstanceCoreUtilities
-
public class SubstanceCoreUtilities extends Object
Various utility functions. This class is for internal use only.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceSubstanceCoreUtilities.TextComponentAware<T>
-
Field Summary
Fields Modifier and Type Field Description static StringIS_COVERED_BY_LIGHTWEIGHT_POPUPSClient property name for marking components covered by lightweight popups.static booleanreallyPrintstatic booleanreallyThrowstatic StringTEXT_COMPONENT_AWARE
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static BufferedImageblendImagesHorizontal(BufferedImage imageLeft, BufferedImage imageRight, double start, double end)Blends two images along X-axis.static BufferedImageblendImagesVertical(BufferedImage imageTop, BufferedImage imageBottom, double start, double end)Blends two images along Y-axis.static booleancanReplaceChildBackgroundColor(Color background)static StringclipString(FontMetrics metrics, int availableWidth, String fullText)Clips string based on specified font metrics and available width (in pixels).static BufferedImagecreateCompatibleImage(BufferedImage image)Creates a compatible image (for efficient processing and drawing).static IcongetArrowIcon(AbstractButton button, int orientation)Returns the arrow icon.static IcongetArrowIcon(JComponent comp, TransitionAwareIcon.TransitionAwareUIDelegate transitionAwareUIDelegate, int orientation)Returns the arrow icon.static BufferedImagegetBlankImage(int width, int height)Retrieves transparent image of specified dimension.static VolatileImagegetBlankVolatileImage(int width, int height)Retrieves transparent image of specified dimension.static SubstanceBorderPaintergetBorderPainter(Component comp)Returns the border painter for the specified component.static SubstanceButtonShapergetButtonShaper(Component comp)Returns the button shaper of the specified button.static ClassLoadergetClassLoaderForResources()Returns the class loader for loading the resource files.static intgetCloseButtonSize(JTabbedPane tabbedPane, int tabIndex)Returns the size of the close button for a tab in the specified tabbed pane.static doublegetColorizationFactor(Component c)Returns the colorization factor for the specified component.static ObjectgetComboPopupPrototypeDisplayValue(JComboBox combo)Returns the popup prototype display value for the specified combo box.static SubstanceConstants.TabContentPaneBorderKindgetContentBorderKind(JTabbedPane tabbedPane)Returns the content border kind of the specified tabbed pane.static intgetEchoPerChar(JPasswordField jpf)Returns the number of echo characters per each password chanaracter.static SubstanceFillPaintergetFillPainter(Component comp)Returns the fill painter of the specified component.static SubstanceConstants.FocusKindgetFocusKind(Component component)Returns the focus ring kind of the specified component.static HashMapKeygetHashKey(Object... objects)Returns a hash key for the specified parameters.static ContainergetHeaderParent(Component c)Given a component, returns the parent for computing theSubstanceDecorationPainter.static StringgetHierarchy(Component comp)Returns the component hierarchy.static voidgetHierarchy(Component comp, StringBuffer buffer, int level)Computes the component hierarchy.static SubstanceBorderPaintergetHighlightBorderPainter(Component comp)Returns the highlight border painter for the specified component.static IcongetIcon(String iconResource)Returns an icon pointed to by the specified string.static SubstanceConstants.MenuGutterFillKindgetMenuGutterFillKind()Returns the global menu gutter fill kind.static SubstanceColorSchemegetOptionPaneColorScheme(int messageType, SubstanceColorScheme mainScheme)Returns the color scheme for the icon of option panes with the specified message type.static IcongetOriginalIcon(AbstractButton b, Icon defaultIcon)static intgetPopupFlyoutOrientation(JComboBox combobox)Returns the popup flyout orientation for the specified combobox.static intgetPopupParentIndexOf(Component comp, 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 ResourceBundlegetResourceBundle(JComponent jcomp)Returns the resource bundle for the specified component.static BufferedImagegetScaledIconImage(List<Image> imageList, int width, int height)ScansimageListfor best-looking image of specified dimensions.static SubstanceConstants.ScrollPaneButtonPolicyKindgetScrollPaneButtonsPolicyKind(JScrollBar scrollBar)Returns the scroll bar buttons kind of the specified scroll bar.static Set<SubstanceConstants.Side>getSides(JComponent component, String propertyName)Returns the set of sides registered on the specified button.static SubstanceSkingetSkin(Component c)Returns the skin of the specified component.static TabCloseCallbackgetTabCloseCallback(MouseEvent me, JTabbedPane tabbedPane, int tabIndex)Returns the callback to be called upon tab closing (using the tab close button).static JTextComponentgetTextComponentForTransitions(Component c)static org.pushingpixels.trident.swing.SwingRepaintCallbackgetTextComponentRepaintCallback(JTextComponent textComponent)static IcongetThemedIcon(Component comp, Icon orig)static IcongetThemedIcon(JTabbedPane tab, int tabIndex, Icon orig)static JComponentgetTitlePane(JRootPane rootPane)Returns the title pane of the specified root pane.static floatgetToolbarButtonCornerRadius(JComponent button, Insets insets)Returns the corner radius of the specified toolbar button.static StringgetVmParameter(String parameterName)Retrieves a single parameter from the VM flags.static booleanhasCloseButton(JTabbedPane tabbedPane, int tabIndex)Checks whether the specified tab has a close button.static booleanhasFlatAppearance(Component comp, boolean defaultValue)Checks whether the specified component is flat.static booleanhasFlatAppearance(AbstractButton button)Computes whether the specified button has flat appearance.static booleanhasIcon(AbstractButton button)Checks whether the specified button has associated icon.static booleanhasNoMinSizeProperty(AbstractButton button)Checks whether the specified button should have minimal size.static booleanhasText(AbstractButton button)Checks whether the specified button has associated text.static booleanisButtonNeverPainted(JComponent button)Checks whether the specified button never paints its background.static booleanisComboBoxButton(AbstractButton button)Checks and answers if the specified button is in a combo box.static booleanisCoveredByLightweightPopups(Component comp)static booleanisInternalFrameModified(JInternalFrame internalFrame)Retrieves themodifiedstate for the specified internal frame.static booleanisOpaque(Component c)static booleanisPaintRootPaneActivated(JRootPane rp)static booleanisRootPaneAutoDeactivate(JRootPane rp)static booleanisRootPaneModified(JRootPane rootPane)Retrieves themodifiedstate for the specified root pane.static booleanisRoundedCorners(Component c)static booleanisScrollBarButton(AbstractButton button)Checks and answers if the specified button is in a scroll bar.static booleanisScrollButton(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 booleanisSecondaryWindow(JRootPane rp)static booleanisSpinnerButton(AbstractButton button)Checks and answers if the specified button is in a spinner.static booleanisTabModified(Component tabComponent)Retrieves themodifiedstate for the specified component in a tabbed pane.static booleanisTitleCloseButton(JComponent ab)Returns indication whether the specified button is a close button on some title pane.static booleanisToolBarButton(JComponent component)Checks and answers if the specified button is in a toolbar.static voidmakeNonOpaque(Component comp, Map<Component,Boolean> opacitySnapshot)Makes the specified component and all its descendants non-opaque.static voidpaintFocus(Graphics g, Component mainComp, Component focusedComp, TransitionAwareUI transitionAwareUI, Shape focusShape, Rectangle textRect, float maxAlphaCoef, int extraPadding)Paints the focus ring on the specified component.static booleanreallyPrintThreadingExceptions()static booleanreallyThrowThreadingExceptions()static voidrestoreOpaque(Component comp, Map<Component,Boolean> opacitySnapshot)Restores the opacity of the specified component and all its descendants.static BufferedImagesoftClip(int width, int height, BufferedImage source, Shape clipShape)Creates a soft-clipped image.static voidstopThreads()Stops all Substance threads.static voidtestComponentCreationThreadingViolation(Component comp)Tests UI threading violations on creating the specified component.static voidtestComponentStateChangeThreadingViolation(Component comp)Tests UI threading violations on changing the state the specified component.static voidtestWindowCloseThreadingViolation(Window w)Tests UI threading violations on closing the specified window.static booleantoAnimateCloseIconOfModifiedTab(JTabbedPane tabbedPane, int tabIndex)Checks whether the specified tab should show modified animation only on its close button.static booleantoDrawWatermark(Component component)Returns indication whether the watermark should be drawn on the specified component.static booleantoShowExtraWidgets(Component component)Checks whether the specified component has extra Substance-specific UI elements.static voidtraceSubstanceApiUsage(Component comp, String message)static voiduninstallMenu(JMenuItem menuItem)Uninstalls the specified menu item.static booleanuseThemedDefaultIcon(JComponent comp)Checks whether the specified component will show scheme-colorized icon in the default state.
-
-
-
Field Detail
-
IS_COVERED_BY_LIGHTWEIGHT_POPUPS
public static final 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 String TEXT_COMPONENT_AWARE
- See Also:
- Constant Field Values
-
reallyThrow
public static final boolean reallyThrow
-
reallyPrint
public static final boolean reallyPrint
-
-
Method Detail
-
clipString
public static String clipString(FontMetrics metrics, int availableWidth, 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(AbstractButton button)
Checks whether the specified button has associated icon.- Parameters:
button- Button.- Returns:
- If the button has associated icon,
trueis returned, otherwisefalse.
-
hasText
public static boolean hasText(AbstractButton button)
Checks whether the specified button has associated text.- Parameters:
button- Button.- Returns:
- If the button has associated text,
trueis returned, otherwisefalse.
-
isComboBoxButton
public static boolean isComboBoxButton(AbstractButton button)
Checks and answers if the specified button is in a combo box.- Parameters:
button- the button to check- Returns:
trueif in combo box,falseotherwise
-
isScrollBarButton
public static boolean isScrollBarButton(AbstractButton button)
Checks and answers if the specified button is in a scroll bar.- Parameters:
button- the button to check- Returns:
trueif in scroll bar,falseotherwise
-
isSpinnerButton
public static boolean isSpinnerButton(AbstractButton button)
Checks and answers if the specified button is in a spinner.- Parameters:
button- the button to check- Returns:
trueif in spinner,falseotherwise
-
isToolBarButton
public static boolean isToolBarButton(JComponent component)
Checks and answers if the specified button is in a toolbar.- Parameters:
component- the button to check- Returns:
trueif in toolbar,falseotherwise
-
isScrollButton
public static boolean isScrollButton(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:
trueif the specified component is a button in a scroll control,falseotherwise
-
isButtonNeverPainted
public static boolean isButtonNeverPainted(JComponent button)
Checks whether the specified button never paints its background.- Parameters:
button- Button.- Returns:
trueif the specified button never paints its background,falseotherwise.- See Also:
SubstanceLookAndFeel.BUTTON_PAINT_NEVER_PROPERTY
-
getFocusKind
public static SubstanceConstants.FocusKind getFocusKind(Component component)
Returns the focus ring kind of the specified component.- Parameters:
component- Component.- Returns:
- The focus ring kind of the specified component.
- See Also:
SubstanceLookAndFeel.FOCUS_KIND
-
toDrawWatermark
public static boolean toDrawWatermark(Component component)
Returns indication whether the watermark should be drawn on the specified component.- Parameters:
component- Component.- Returns:
trueif the watermark should be drawn on the specified component,falseotherwise.- See Also:
SubstanceLookAndFeel.WATERMARK_VISIBLE
-
getButtonShaper
public static SubstanceButtonShaper getButtonShaper(Component comp)
Returns the button shaper of the specified button.- Parameters:
comp- The button.- Returns:
- The button shaper of the specified button.
- See Also:
SubstanceLookAndFeel.BUTTON_SHAPER_PROPERTY,SubstanceSkin.getButtonShaper()
-
getFillPainter
public static SubstanceFillPainter getFillPainter(Component comp)
Returns the fill painter of the specified component.- Parameters:
comp- Component.- Returns:
- The fill painter of the specified component.
- See Also:
SubstanceSkin.getFillPainter()
-
isTabModified
public static boolean isTabModified(Component tabComponent)
Retrieves themodifiedstate for the specified component in a tabbed pane.- Parameters:
tabComponent- The associated tab component.- Returns:
trueif the specified component in a tabbed pane is marked as modified,falseotherwise.- See Also:
SubstanceLookAndFeel.WINDOW_MODIFIED
-
isRootPaneModified
public static boolean isRootPaneModified(JRootPane rootPane)
Retrieves themodifiedstate for the specified root pane.- Parameters:
rootPane- The root pane.- Returns:
trueif the specified root pane is marked as modified,falseotherwise.- See Also:
SubstanceLookAndFeel.WINDOW_MODIFIED
-
isInternalFrameModified
public static boolean isInternalFrameModified(JInternalFrame internalFrame)
Retrieves themodifiedstate for the specified internal frame.- Parameters:
internalFrame- The internal frame.- Returns:
trueif the specified internal frame is marked as modified,falseotherwise.- See Also:
SubstanceLookAndFeel.WINDOW_MODIFIED
-
isRootPaneAutoDeactivate
public static boolean isRootPaneAutoDeactivate(JRootPane rp)
-
isPaintRootPaneActivated
public static boolean isPaintRootPaneActivated(JRootPane rp)
-
isSecondaryWindow
public static boolean isSecondaryWindow(JRootPane rp)
-
isRoundedCorners
public static boolean isRoundedCorners(Component c)
-
hasCloseButton
public static boolean hasCloseButton(JTabbedPane tabbedPane, int tabIndex)
Checks whether the specified tab has a close button.- Parameters:
tabbedPane- Tabbed pane.tabIndex- Tab index.- Returns:
trueif the specified tab has a close button,falseotherwise.- See Also:
SubstanceLookAndFeel.TABBED_PANE_CLOSE_BUTTONS_PROPERTY
-
getCloseButtonSize
public static int getCloseButtonSize(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 SubstanceConstants.TabContentPaneBorderKind getContentBorderKind(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:
SubstanceLookAndFeel.TABBED_PANE_CONTENT_BORDER_KIND
-
toAnimateCloseIconOfModifiedTab
public static boolean toAnimateCloseIconOfModifiedTab(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:
trueif the specified tab should show modified animation only on its close button,falseotherwise.- See Also:
SubstanceLookAndFeel.TABBED_PANE_CLOSE_BUTTONS_MODIFIED_ANIMATION
-
getBlankImage
public static 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.
-
getBlankVolatileImage
public static VolatileImage getBlankVolatileImage(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(AbstractButton button)
Checks whether the specified button should have minimal size.- Parameters:
button- Button.- Returns:
falseif the specified button should have minimal size,trueotherwise.- See Also:
SubstanceLookAndFeel.BUTTON_NO_MIN_SIZE_PROPERTY
-
hasFlatAppearance
public static boolean hasFlatAppearance(Component comp, boolean defaultValue)
Checks whether the specified component is flat.- Parameters:
comp- Component.defaultValue- The value to return if there is noSubstanceLookAndFeel.FLAT_PROPERTYdefined on button hierarchy orUIManager.- Returns:
falseif the specified button is flat,trueotherwise.- See Also:
SubstanceLookAndFeel.FLAT_PROPERTY
-
hasFlatAppearance
public static boolean hasFlatAppearance(AbstractButton button)
Computes whether the specified button has flat appearance.- Parameters:
button- Button.- Returns:
trueif the button has flat appearance,falseotherwise.
-
getPopupFlyoutOrientation
public static int getPopupFlyoutOrientation(JComboBox combobox)
Returns the popup flyout orientation for the specified combobox.- Parameters:
combobox- Combobox.- Returns:
- The popup flyout orientation for the specified combobox.
- See Also:
SubstanceLookAndFeel.COMBO_BOX_POPUP_FLYOUT_ORIENTATION
-
makeNonOpaque
public static void makeNonOpaque(Component comp, Map<Component,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(Component comp, Map<Component,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.
-
createCompatibleImage
public static BufferedImage createCompatibleImage(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(JComponent comp)
Checks whether the specified component will show scheme-colorized icon in the default state.- Parameters:
comp- Component.- Returns:
trueif the specified component will show scheme-colorized icon in the default state,falseotherwise.- See Also:
SubstanceLookAndFeel.USE_THEMED_DEFAULT_ICONS
-
getTabCloseCallback
public static TabCloseCallback getTabCloseCallback(MouseEvent me, 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).
- See Also:
SubstanceLookAndFeel.TABBED_PANE_CLOSE_CALLBACK
-
blendImagesVertical
public static BufferedImage blendImagesVertical(BufferedImage imageTop, 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.
-
blendImagesHorizontal
public static BufferedImage blendImagesHorizontal(BufferedImage imageLeft, 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.
-
getOptionPaneColorScheme
public static SubstanceColorScheme getOptionPaneColorScheme(int messageType, SubstanceColorScheme 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.
-
getComboPopupPrototypeDisplayValue
public static Object getComboPopupPrototypeDisplayValue(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.
- See Also:
SubstanceLookAndFeel.COMBO_POPUP_PROTOTYPE
-
getScrollPaneButtonsPolicyKind
public static SubstanceConstants.ScrollPaneButtonPolicyKind getScrollPaneButtonsPolicyKind(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.
- See Also:
SubstanceLookAndFeel.SCROLL_PANE_BUTTONS_POLICY
-
getSides
public static Set<SubstanceConstants.Side> getSides(JComponent component, 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(JComponent button, 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.
- See Also:
SubstanceLookAndFeel.CORNER_RADIUS
-
getEchoPerChar
public static int getEchoPerChar(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.
- See Also:
SubstanceLookAndFeel.PASSWORD_ECHO_PER_CHAR
-
softClip
public static BufferedImage softClip(int width, int height, BufferedImage source, Shape clipShape)
Creates a soft-clipped image. Code taken from here.
-
toShowExtraWidgets
public static boolean toShowExtraWidgets(Component component)
Checks whether the specified component has extra Substance-specific UI elements.- Parameters:
component- Component.- Returns:
trueif the specified component has extra Substance-specific UI elements,falseotherwise.- See Also:
SubstanceLookAndFeel.SHOW_EXTRA_WIDGETS
-
getThemedIcon
public static Icon getThemedIcon(JTabbedPane tab, int tabIndex, Icon orig)
-
getOriginalIcon
public static Icon getOriginalIcon(AbstractButton b, Icon defaultIcon)
-
getMenuGutterFillKind
public static SubstanceConstants.MenuGutterFillKind getMenuGutterFillKind()
Returns the global menu gutter fill kind.- Returns:
- The global menu gutter fill kind.
- See Also:
SubstanceLookAndFeel.MENU_GUTTER_FILL_KIND
-
getHeaderParent
public static Container getHeaderParent(Component c)
Given a component, returns the parent for computing theSubstanceDecorationPainter.- Parameters:
c- Component.- Returns:
- The parent for computing the
SubstanceDecorationPainter.
-
paintFocus
public static void paintFocus(Graphics g, Component mainComp, Component focusedComp, TransitionAwareUI transitionAwareUI, Shape focusShape, 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 aJSpinner, while the focused component is a text field inside the the spinner editor.focusShape- Focus shape. May benull- in this case, the bounds ofmainCompwill 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.
-
isTitleCloseButton
public static boolean isTitleCloseButton(JComponent ab)
Returns indication whether the specified button is a close button on some title pane.- Parameters:
ab- Button.- Returns:
trueif the specified button is a close button on some title pane,falseotherwise.
-
uninstallMenu
public static void uninstallMenu(JMenuItem menuItem)
Uninstalls the specified menu item.- Parameters:
menuItem- Menu item.
-
getIcon
public static Icon getIcon(String iconResource)
Returns an icon pointed to by the specified string.- Parameters:
iconResource- Resource location string.- Returns:
- Icon.
-
getClassLoaderForResources
public static 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, the 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(Component comp)
-
getPopupParentIndexOf
public static int getPopupParentIndexOf(Component comp, 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.
-
getResourceBundle
public static ResourceBundle getResourceBundle(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(Component comp)
Returns the border painter for the specified component.- Parameters:
comp- Component.- Returns:
- Border painter for the specified component.
- See Also:
SubstanceSkin.getBorderPainter()
-
getHighlightBorderPainter
public static SubstanceBorderPainter getHighlightBorderPainter(Component comp)
Returns the highlight border painter for the specified component.- Parameters:
comp- Component.- Returns:
- Highlight border painter for the specified component.
- See Also:
SubstanceSkin.getBorderPainter(),SubstanceSkin.getHighlightBorderPainter()
-
getHierarchy
public static String getHierarchy(Component comp)
Returns the component hierarchy.- Parameters:
comp- Component.- Returns:
- Component hierarchy string.
-
getHierarchy
public static void getHierarchy(Component comp, StringBuffer buffer, int level)
Computes the component hierarchy.- Parameters:
comp- Component.buffer- Hierarchy representation buffer.level- Hierarchy level.
-
getTitlePane
public static JComponent getTitlePane(JRootPane rootPane)
Returns the title pane of the specified root pane.- Parameters:
rootPane- Root pane.- Returns:
- The title pane of the specified root pane.
-
getArrowIcon
public static Icon getArrowIcon(AbstractButton button, int orientation)
Returns the arrow icon.- Parameters:
button- Button.orientation- Arrow orientation.- Returns:
- Arrow icon.
-
getArrowIcon
public static Icon getArrowIcon(JComponent comp, TransitionAwareIcon.TransitionAwareUIDelegate transitionAwareUIDelegate, int orientation)
Returns the arrow icon.- Parameters:
comp- Component.orientation- Arrow orientation.- Returns:
- Arrow icon.
-
getColorizationFactor
public static double getColorizationFactor(Component c)
Returns the colorization factor for the specified component.- Parameters:
c- Component.- Returns:
- The colorization factor for the specified component.
- See Also:
SubstanceLookAndFeel.COLORIZATION_FACTOR
-
getSkin
public static SubstanceSkin getSkin(Component c)
Returns the skin of the specified component.- Parameters:
c- Component.- Returns:
- The skin of the specified component.
- See Also:
SubstanceLookAndFeel.SKIN_PROPERTY
-
getHashKey
public static HashMapKey getHashKey(Object... objects)
Returns a hash key for the specified parameters.- Parameters:
objects- Key components.- Returns:
- Hash key.
-
stopThreads
public static void stopThreads()
Stops all Substance threads. Improper use may result in UI artifacts and runtime exceptions.
-
getVmParameter
public static String getVmParameter(String parameterName)
Retrieves a single parameter from the VM flags.- Parameters:
parameterName- Parameter name.- Returns:
- Parameter value.
-
reallyPrintThreadingExceptions
public static boolean reallyPrintThreadingExceptions()
-
reallyThrowThreadingExceptions
public static boolean reallyThrowThreadingExceptions()
-
testComponentCreationThreadingViolation
public static void testComponentCreationThreadingViolation(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(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(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.
-
getScaledIconImage
public static BufferedImage getScaledIconImage(List<Image> imageList, int width, int height)
ScansimageListfor best-looking image of specified dimensions. Image can be scaled and/or padded with transparency.
-
canReplaceChildBackgroundColor
public static boolean canReplaceChildBackgroundColor(Color background)
-
getTextComponentForTransitions
public static JTextComponent getTextComponentForTransitions(Component c)
-
getTextComponentRepaintCallback
public static org.pushingpixels.trident.swing.SwingRepaintCallback getTextComponentRepaintCallback(JTextComponent textComponent)
-
isOpaque
public static boolean isOpaque(Component c)
-
-