public class LafWidgetUtilities
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
PREVIEW_MODE
Name for the internal client property that marks a component as
previewable.
|
Modifier and Type | Method and Description |
---|---|
static java.awt.image.BufferedImage |
createCompatibleImage(java.awt.image.BufferedImage image)
Creates a compatible image (for efficient processing and drawing).
|
static java.awt.image.BufferedImage |
createThumbnail(java.awt.image.BufferedImage image,
int requestedThumbWidth)
Creates a thumbnail of the specified width.
|
static void |
firePropertyChangeEvent(javax.swing.JComponent component,
java.lang.String propertyName,
java.lang.Object oldValue,
java.lang.Object newValue)
Fires the matching property change event on the specific component.
|
static java.awt.Composite |
getAlphaComposite(java.awt.Component c)
Returns the composite to use for painting the specified component.
|
static java.awt.Composite |
getAlphaComposite(java.awt.Component c,
float translucency) |
static java.awt.Composite |
getAlphaComposite(java.awt.Component c,
float translucency,
java.awt.Graphics g)
Returns the composite to use for painting the specified component.
|
static java.awt.Composite |
getAlphaComposite(java.awt.Component c,
java.awt.Graphics g)
Returns the composite to use for painting the specified component.
|
static java.awt.image.BufferedImage |
getBlankImage(int width,
int height)
Retrieves transparent image of specified dimension.
|
static javax.swing.Icon |
getHexaMarker(int value)
Returns small icon representation of the specified integer value.
|
static javax.swing.Icon |
getIcon(javax.swing.AbstractButton b)
Returns the current icon for the specified button.
|
static java.util.ResourceBundle |
getResourceBundle(javax.swing.JComponent jcomp)
Returns the resource bundle for the specified component.
|
static javax.swing.Icon |
getSearchIcon(int dimension,
boolean leftToRight)
Returns search icon.
|
static javax.swing.Icon |
getSmallLockIcon()
Returns a lock icon.
|
static boolean |
hasAutomaticDnDSupport(javax.swing.JTree tree)
Checks whether the specified tree component has automatic drag and drop
support.
|
static boolean |
hasAutoScroll(javax.swing.JScrollPane scrollPane)
Checks whether the specified scroll pane supports auto scroll.
|
static boolean |
hasNoAnimations(java.awt.Component comp,
AnimationFacet animationFacet)
Checks whether the specified component has been configured (specifically
or globally) to have no animations of the specific facet.
|
static boolean |
hasTextEditContextMenu(javax.swing.text.JTextComponent textComp)
Checks whether the specified text component has edit context menu
property.
|
static boolean |
hasTextFlipSelectOnEscapeProperty(javax.swing.text.JTextComponent textComp)
Checks whether the specified text component has "flip select on escape"
property.
|
static boolean |
hasTextFocusSelectAllProperty(javax.swing.text.JTextComponent textComp)
Checks whether the specified text component has
"select all on focus gain" property.
|
static void |
makePreviewable(java.awt.Component comp,
java.util.Map<java.awt.Component,java.lang.Boolean> dbSnapshot)
Makes the specified component and all its descendants previewable.
|
static void |
restorePreviewable(java.awt.Component comp,
java.util.Map<java.awt.Component,java.lang.Boolean> dbSnapshot)
Restores the regular (non-previewable) status of the specified component
and all its descendants.
|
static void |
testComponentStateChangeThreadingViolation(java.awt.Component comp)
Tests UI threading violations on changing the state the specified
component.
|
static boolean |
toIgnoreAnimations(java.awt.Component comp) |
static boolean |
toIgnoreGlobalLocale(javax.swing.JComponent jcomp)
Checks whether the label lookup should use component-specific locale on
the specified component.
|
public static final java.lang.String PREVIEW_MODE
public static java.awt.image.BufferedImage getBlankImage(int width, int height)
width
- Image width.height
- Image height.public static java.awt.image.BufferedImage createCompatibleImage(java.awt.image.BufferedImage image)
image
- The original image.public static java.awt.image.BufferedImage createThumbnail(java.awt.image.BufferedImage image, int requestedThumbWidth)
image
- The original image.requestedThumbWidth
- The width of the resulting thumbnail.public static javax.swing.Icon getSearchIcon(int dimension, boolean leftToRight)
dimension
- Icon dimension.leftToRight
- Indicates the orientation of the resulting icon.public static javax.swing.Icon getHexaMarker(int value)
value
- Integer value to represent.public static void makePreviewable(java.awt.Component comp, java.util.Map<java.awt.Component,java.lang.Boolean> dbSnapshot)
comp
- Component.dbSnapshot
- The "snapshot" map that will contain the original
double-buffer status of the specified component and all its
descendants. Key is JComponent
, value is
Boolean
.public static void restorePreviewable(java.awt.Component comp, java.util.Map<java.awt.Component,java.lang.Boolean> dbSnapshot)
comp
- Component.dbSnapshot
- The "snapshot" map that contains the original double-buffer
status of the specified component and all its descendants. Key
is JComponent
, value is Boolean
.public static javax.swing.Icon getSmallLockIcon()
public static boolean hasTextFocusSelectAllProperty(javax.swing.text.JTextComponent textComp)
textComp
- Text component.true
if the specified text component has "select all
on focus gain" property, false
otherwise.public static boolean hasTextFlipSelectOnEscapeProperty(javax.swing.text.JTextComponent textComp)
textComp
- Text component.true
if the specified text component has "flip
select on escape" property, false
otherwise.public static boolean hasTextEditContextMenu(javax.swing.text.JTextComponent textComp)
textComp
- Text component.true
if the specified text component has edit
context menu property, false
otherwise.public static boolean hasAutoScroll(javax.swing.JScrollPane scrollPane)
scrollPane
- Scroll pane component.true
if the specified scroll pane supports auto
scroll, false
otherwise.public static boolean hasAutomaticDnDSupport(javax.swing.JTree tree)
tree
- Tree component.true
if the specified text component has automatic
drag and drop support, false
otherwise.public static boolean toIgnoreGlobalLocale(javax.swing.JComponent jcomp)
jcomp
- Component.true
if the custom labels should be looked up based
on the component locale as returned by
Component.getLocale()
, false
if the custom
labels should be looked up based on the global locale as returned
by Locale.getDefault()
.public static java.util.ResourceBundle getResourceBundle(javax.swing.JComponent jcomp)
jcomp
- Component.public static boolean hasNoAnimations(java.awt.Component comp, AnimationFacet animationFacet)
comp
- Component.animationFacet
- Animation facet.true
if the specified component has been configured
(specifically or globally) to have no animations of the specific
facet, false
otherwise.public static javax.swing.Icon getIcon(javax.swing.AbstractButton b)
b
- Button.public static boolean toIgnoreAnimations(java.awt.Component comp)
public static void testComponentStateChangeThreadingViolation(java.awt.Component comp)
comp
- Component.UiThreadingViolationException
- If the component is changing state off Event Dispatch Thread.public static void firePropertyChangeEvent(javax.swing.JComponent component, java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue)
component
- Component.propertyName
- Property name.oldValue
- Old property value.newValue
- New property value.public static java.awt.Composite getAlphaComposite(java.awt.Component c, float translucency, java.awt.Graphics g)
Graphics2D
before any custom
rendering is done. This method can be used by application painting code
and by look-and-feel delegates.c
- Component.translucency
- The translucency of the original painting.g
- The original graphics context.public static java.awt.Composite getAlphaComposite(java.awt.Component c, float translucency)
public static java.awt.Composite getAlphaComposite(java.awt.Component c, java.awt.Graphics g)
Graphics2D
before any custom
rendering is done. This method can be used by application painting code
and by look-and-feel delegates.c
- Component.public static java.awt.Composite getAlphaComposite(java.awt.Component c)
Graphics2D
before any custom
rendering is done. This method can be used by application painting code
and by look-and-feel delegates.c
- Component.