|
Quaqua 8.0 2011-10-02 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.swing.plaf.basic.BasicGraphicsUtils
ch.randelshofer.quaqua.QuaquaUtilities
public class QuaquaUtilities
Utility class for the Quaqua LAF.
Nested Class Summary | |
---|---|
static class |
QuaquaUtilities.SizeVariant
|
Field Summary |
---|
Fields inherited from interface javax.swing.SwingConstants |
---|
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST |
Method Summary | |
---|---|
static void |
adjustFocus(javax.swing.JComponent tree)
|
static void |
applySizeVariant(javax.swing.JComponent c)
|
static java.lang.Object |
beginGraphics(java.awt.Graphics2D graphics2d)
Turns on common rendering hints for UI delegates. |
static java.awt.Component |
compositeRequestFocus(java.awt.Component component)
Copied from BasicLookAndFeel. |
static int |
convertModifiersToDropAction(int modifiers,
int supportedActions)
|
static java.awt.image.BufferedImage |
createBufferedImage(java.net.URL location)
|
static java.awt.TexturePaint |
createTexturePaint(java.net.URL location)
|
static void |
drawStringUnderlineCharAt(java.awt.Graphics g,
java.lang.String text,
int underlinedIndex,
int x,
int y)
Draw a string with the graphics g at location
(x , y )
just like g.drawString would. |
static void |
endGraphics(java.awt.Graphics2D graphics2d,
java.lang.Object oldHints)
Restores rendering hints for UI delegates. |
static java.awt.Component |
findFocusOwner(java.awt.Component c)
Return the child Component of the specified
Component that is the focus owner, if any. |
static int |
getDragThreshold()
|
static java.lang.String |
getKeyModifiersText(int modifiers,
boolean leftToRight)
Returns a Mac OS X specific String describing the modifier key(s), such as "Shift", or "Ctrl+Shift". |
static int |
getLeftSideBearing(java.awt.Font f,
java.lang.String string)
|
static QuaquaUtilities.SizeVariant |
getSizeVariant(java.awt.Component c)
Gets the size variant of a component. |
static java.awt.Font |
getSizeVariantFont(javax.swing.JComponent c)
|
static java.lang.Object |
getUIOfType(javax.swing.plaf.ComponentUI ui,
java.lang.Class klass)
Returns the ui that is of type klass , or null if
one can not be found. |
static java.awt.Rectangle |
getVisualBounds(java.awt.Component c,
int type)
Returns the visual bounds of the component given in the local coordinate system of the component. |
static void |
installProperty(javax.swing.JComponent c,
java.lang.String propertyName,
java.lang.Object value)
Convenience method for installing a property with the specified name and value on a component if that property has not already been set by the client program. |
static boolean |
isFocused(java.awt.Component component)
Returns true, if the specified component is focus owner or permanent focus owner and if the component is on an the active window. |
static boolean |
isLeftToRight(java.awt.Component c)
|
static boolean |
isOnActiveWindow(java.awt.Component c)
Returns true if the component is on a Dialog or a Frame, which is active, or if it is on a Window, which is focused. |
static boolean |
isOnActiveWindow(java.awt.Component c,
boolean isActiveWhenSheetIsActive)
Returns true if the component is on a Dialog or a Frame, which is active, or if it is on a Window, which is focused. |
static boolean |
isOnTexturedWindow(java.awt.Component c)
|
static java.lang.String |
layoutCompoundLabel(java.awt.FontMetrics fm,
java.lang.String text,
javax.swing.Icon icon,
int verticalAlignment,
int horizontalAlignment,
int verticalTextPosition,
int horizontalTextPosition,
java.awt.Rectangle viewR,
java.awt.Rectangle iconR,
java.awt.Rectangle textR,
int textIconGap)
Compute and return the location of the icons origin, the location of origin of the text baseline, and a possibly clipped version of the compound labels string. |
static java.lang.String |
layoutCompoundLabel(javax.swing.JComponent c,
java.awt.FontMetrics fm,
java.lang.String text,
javax.swing.Icon icon,
int verticalAlignment,
int horizontalAlignment,
int verticalTextPosition,
int horizontalTextPosition,
java.awt.Rectangle viewR,
java.awt.Rectangle iconR,
java.awt.Rectangle textR,
int textIconGap)
Compute and return the location of the icons origin, the location of origin of the text baseline, and a possibly clipped version of the compound labels string. |
static int |
mapDragOperationFromModifiers(java.awt.event.MouseEvent me,
javax.swing.TransferHandler th)
|
static void |
repaintBorder(javax.swing.JComponent component)
|
Methods inherited from class javax.swing.plaf.basic.BasicGraphicsUtils |
---|
drawBezel, drawDashedRect, drawEtchedRect, drawGroove, drawLoweredBezel, drawString, getEtchedInsets, getGrooveInsets, getPreferredButtonSize |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static boolean isLeftToRight(java.awt.Component c)
public static void drawStringUnderlineCharAt(java.awt.Graphics g, java.lang.String text, int underlinedIndex, int x, int y)
g
at location
(x
, y
)
just like g.drawString
would.
The character at index underlinedIndex
in text will be underlined. If index
is beyond the
bounds of text
(including < 0), nothing will be
underlined.
g
- Graphics to draw withtext
- String to drawunderlinedIndex
- Index of character in text to underlinex
- x coordinate to draw aty
- y coordinate to draw atpublic static boolean isOnActiveWindow(java.awt.Component c)
public static boolean isOnActiveWindow(java.awt.Component c, boolean isActiveWhenSheetIsActive)
c
- The component.isActiveWhenSheetIsActive
- Set this to true, when the window should
be considered as active when its sheet dialog is active.public static java.lang.String getKeyModifiersText(int modifiers, boolean leftToRight)
public static void repaintBorder(javax.swing.JComponent component)
public static java.lang.Object beginGraphics(java.awt.Graphics2D graphics2d)
public static void endGraphics(java.awt.Graphics2D graphics2d, java.lang.Object oldHints)
public static boolean isFocused(java.awt.Component component)
public static int getLeftSideBearing(java.awt.Font f, java.lang.String string)
public static java.awt.image.BufferedImage createBufferedImage(java.net.URL location)
public static java.awt.TexturePaint createTexturePaint(java.net.URL location)
public static java.lang.String layoutCompoundLabel(javax.swing.JComponent c, java.awt.FontMetrics fm, java.lang.String text, javax.swing.Icon icon, int verticalAlignment, int horizontalAlignment, int verticalTextPosition, int horizontalTextPosition, java.awt.Rectangle viewR, java.awt.Rectangle iconR, java.awt.Rectangle textR, int textIconGap)
public static java.lang.String layoutCompoundLabel(java.awt.FontMetrics fm, java.lang.String text, javax.swing.Icon icon, int verticalAlignment, int horizontalAlignment, int verticalTextPosition, int horizontalTextPosition, java.awt.Rectangle viewR, java.awt.Rectangle iconR, java.awt.Rectangle textR, int textIconGap)
public static java.awt.Component compositeRequestFocus(java.awt.Component component)
public static void installProperty(javax.swing.JComponent c, java.lang.String propertyName, java.lang.Object value)
c
- the target component for installing the propertypropertyName
- String containing the name of the property to be set
java.lang.IllegalArgumentException
- if the specified property is not
one which can be set using this method
java.lang.ClassCastException
- may be thrown if the property value
specified does not match the property's type
java.lang.NullPointerException
- may be thrown if c or propertyValue is nullpublic static java.lang.Object getUIOfType(javax.swing.plaf.ComponentUI ui, java.lang.Class klass)
klass
, or null if
one can not be found.
public static void adjustFocus(javax.swing.JComponent tree)
public static QuaquaUtilities.SizeVariant getSizeVariant(java.awt.Component c)
The size variant can be explicitly set using the client property "JComponent.sizeVariant="regular"|"small"|"mini".
The default size variant is "regular". If a component is a cell renderer, the default size variant is "small".
c
-
public static java.awt.Font getSizeVariantFont(javax.swing.JComponent c)
public static void applySizeVariant(javax.swing.JComponent c)
public static int getDragThreshold()
public static int mapDragOperationFromModifiers(java.awt.event.MouseEvent me, javax.swing.TransferHandler th)
public static int convertModifiersToDropAction(int modifiers, int supportedActions)
public static java.awt.Component findFocusOwner(java.awt.Component c)
Component
of the specified
Component
that is the focus owner, if any.
c
- the root of the Component
hierarchy to
search for the focus owner
null
if there is no focus
owner, or if the focus owner is not comp
, or a
descendant of comp
KeyboardFocusManager.getFocusOwner()
public static boolean isOnTexturedWindow(java.awt.Component c)
public static java.awt.Rectangle getVisualBounds(java.awt.Component c, int type)
c
- The component.type
- A type from VisuallyLayoutable
.
|
Copyright 2003-2007 (c) Werner Randelshofer. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |