public class LafWidgetUtilities extends Object
Modifier and Type | Field | Description |
---|---|---|
static String |
PREVIEW_MODE |
Name for the internal client property that marks a component as
previewable.
|
Modifier and Type | Method | Description |
---|---|---|
static BufferedImage |
createCompatibleImage(BufferedImage image) |
Creates a compatible image (for efficient processing and drawing).
|
static BufferedImage |
createThumbnail(BufferedImage image,
int requestedThumbWidth) |
Creates a thumbnail of the specified width.
|
static void |
firePropertyChangeEvent(JComponent component,
String propertyName,
Object oldValue,
Object newValue) |
Fires the matching property change event on the specific component.
|
static Composite |
getAlphaComposite(Component c) |
Returns the composite to use for painting the specified component.
|
static Composite |
getAlphaComposite(Component c,
float translucency) |
|
static Composite |
getAlphaComposite(Component c,
float translucency,
Graphics g) |
Returns the composite to use for painting the specified component.
|
static Composite |
getAlphaComposite(Component c,
Graphics g) |
Returns the composite to use for painting the specified component.
|
static BufferedImage |
getBlankImage(int width,
int height) |
Retrieves transparent image of specified dimension.
|
static Icon |
getHexaMarker(int value) |
Returns small icon representation of the specified integer value.
|
static Icon |
getIcon(AbstractButton b) |
Returns the current icon for the specified button.
|
static ResourceBundle |
getResourceBundle(JComponent jcomp) |
Returns the resource bundle for the specified component.
|
static Icon |
getSearchIcon(int dimension,
boolean leftToRight) |
Returns search icon.
|
static Icon |
getSmallLockIcon() |
Returns a lock icon.
|
static boolean |
hasAutomaticDnDSupport(JTree tree) |
Checks whether the specified tree component has automatic drag and drop
support.
|
static boolean |
hasAutoScroll(JScrollPane scrollPane) |
Checks whether the specified scroll pane supports auto scroll.
|
static boolean |
hasNoAnimations(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(JTextComponent textComp) |
Checks whether the specified text component has edit context menu
property.
|
static boolean |
hasTextFlipSelectOnEscapeProperty(JTextComponent textComp) |
Checks whether the specified text component has "flip select on escape"
property.
|
static boolean |
hasTextFocusSelectAllProperty(JTextComponent textComp) |
Checks whether the specified text component has
"select all on focus gain" property.
|
static void |
makePreviewable(Component comp,
Map<Component,Boolean> dbSnapshot) |
Makes the specified component and all its descendants previewable.
|
static void |
restorePreviewable(Component comp,
Map<Component,Boolean> dbSnapshot) |
Restores the regular (non-previewable) status of the specified component
and all its descendants.
|
static void |
testComponentStateChangeThreadingViolation(Component comp) |
Tests UI threading violations on changing the state the specified
component.
|
static boolean |
toIgnoreAnimations(Component comp) |
|
static boolean |
toIgnoreGlobalLocale(JComponent jcomp) |
Checks whether the label lookup should use component-specific locale on
the specified component.
|
public static final String PREVIEW_MODE
public static BufferedImage getBlankImage(int width, int height)
width
- Image width.height
- Image height.public static BufferedImage createCompatibleImage(BufferedImage image)
image
- The original image.public static BufferedImage createThumbnail(BufferedImage image, int requestedThumbWidth)
image
- The original image.requestedThumbWidth
- The width of the resulting thumbnail.public static Icon getSearchIcon(int dimension, boolean leftToRight)
dimension
- Icon dimension.leftToRight
- Indicates the orientation of the resulting icon.public static Icon getHexaMarker(int value)
value
- Integer value to represent.public static void makePreviewable(Component comp, Map<Component,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(Component comp, Map<Component,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 Icon getSmallLockIcon()
public static boolean hasTextFocusSelectAllProperty(JTextComponent textComp)
textComp
- Text component.true
if the specified text component has "select all
on focus gain" property, false
otherwise.public static boolean hasTextFlipSelectOnEscapeProperty(JTextComponent textComp)
textComp
- Text component.true
if the specified text component has "flip
select on escape" property, false
otherwise.public static boolean hasTextEditContextMenu(JTextComponent textComp)
textComp
- Text component.true
if the specified text component has edit
context menu property, false
otherwise.public static boolean hasAutoScroll(JScrollPane scrollPane)
scrollPane
- Scroll pane component.true
if the specified scroll pane supports auto
scroll, false
otherwise.public static boolean hasAutomaticDnDSupport(JTree tree)
tree
- Tree component.true
if the specified text component has automatic
drag and drop support, false
otherwise.public static boolean toIgnoreGlobalLocale(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 ResourceBundle getResourceBundle(JComponent jcomp)
jcomp
- Component.public static boolean hasNoAnimations(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 Icon getIcon(AbstractButton b)
b
- Button.public static boolean toIgnoreAnimations(Component comp)
public static void testComponentStateChangeThreadingViolation(Component comp)
comp
- Component.UiThreadingViolationException
- If the component is changing state off Event Dispatch Thread.public static void firePropertyChangeEvent(JComponent component, String propertyName, Object oldValue, Object newValue)
component
- Component.propertyName
- Property name.oldValue
- Old property value.newValue
- New property value.public static Composite getAlphaComposite(Component c, float translucency, 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 Composite getAlphaComposite(Component c, 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 Composite getAlphaComposite(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.