Class QuaquaUtilities
- java.lang.Object
-
- javax.swing.plaf.basic.BasicGraphicsUtils
-
- org.pushingpixels.substance.internal.contrib.randelshofer.quaqua.QuaquaUtilities
-
- All Implemented Interfaces:
SwingConstants
public class QuaquaUtilities extends BasicGraphicsUtils implements SwingConstants
Utility class for the Quaqua LAF.
-
-
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
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Object
beginGraphics(Graphics2D graphics2d)
static Component
compositeRequestFocus(Component component)
Copied from BasicLookAndFeel.static void
configureGraphics(Graphics gr)
static BufferedImage
createBufferedImage(URL location)
static TexturePaint
createTexturePaint(URL location)
static void
drawStringUnderlineCharAt(Graphics g, String text, int underlinedIndex, int x, int y)
Draw a string with the graphicsg
at location (x
,y
) just likeg.drawString
would.static void
endGraphics(Graphics2D graphics2d, Object oldHints)
static 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(Font f, String string)
static boolean
isFocused(Component component)
static boolean
isLeftToRight(Component c)
static boolean
isOnActiveWindow(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 String
layoutCompoundLabel(FontMetrics fm, String text, Icon icon, int verticalAlignment, int horizontalAlignment, int verticalTextPosition, int horizontalTextPosition, Rectangle viewR, Rectangle iconR, 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 String
layoutCompoundLabel(JComponent c, FontMetrics fm, String text, Icon icon, int verticalAlignment, int horizontalAlignment, int verticalTextPosition, int horizontalTextPosition, Rectangle viewR, Rectangle iconR, 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 void
repaintBorder(JComponent component)
-
Methods inherited from class javax.swing.plaf.basic.BasicGraphicsUtils
drawBezel, drawDashedRect, drawEtchedRect, drawGroove, drawLoweredBezel, drawString, drawString, drawStringUnderlineCharAt, getClippedString, getEtchedInsets, getGrooveInsets, getPreferredButtonSize, getStringWidth
-
-
-
-
Method Detail
-
isLeftToRight
public static boolean isLeftToRight(Component c)
-
drawStringUnderlineCharAt
public static void drawStringUnderlineCharAt(Graphics g, String text, int underlinedIndex, int x, int y)
Draw a string with the graphicsg
at location (x
,y
) just likeg.drawString
would. The character at indexunderlinedIndex
in text will be underlined. Ifindex
is beyond the bounds oftext
(including < 0), nothing will be underlined.- Parameters:
g
- Graphics to draw withtext
- String to drawunderlinedIndex
- Index of character in text to underlinex
- x coordinate to draw aty
- y coordinate to draw at- Since:
- 1.4
-
isOnActiveWindow
public static boolean isOnActiveWindow(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. Always returns true, if the component has no parent window.
-
getKeyModifiersText
public static String getKeyModifiersText(int modifiers, boolean leftToRight)
Returns a Mac OS X specific String describing the modifier key(s), such as "Shift", or "Ctrl+Shift".- Returns:
- string a text description of the combination of modifier keys that were held down during the event
-
repaintBorder
public static void repaintBorder(JComponent component)
-
beginGraphics
public static final Object beginGraphics(Graphics2D graphics2d)
-
endGraphics
public static final void endGraphics(Graphics2D graphics2d, Object oldHints)
-
isFocused
public static final boolean isFocused(Component component)
-
createBufferedImage
public static BufferedImage createBufferedImage(URL location)
-
createTexturePaint
public static TexturePaint createTexturePaint(URL location)
-
layoutCompoundLabel
public static String layoutCompoundLabel(JComponent c, FontMetrics fm, String text, Icon icon, int verticalAlignment, int horizontalAlignment, int verticalTextPosition, int horizontalTextPosition, Rectangle viewR, Rectangle iconR, 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. Locations are computed relative to the viewR rectangle. The JComponents orientation (LEADING/TRAILING) will also be taken into account and translated into LEFT/RIGHT values accordingly.
-
layoutCompoundLabel
public static String layoutCompoundLabel(FontMetrics fm, String text, Icon icon, int verticalAlignment, int horizontalAlignment, int verticalTextPosition, int horizontalTextPosition, Rectangle viewR, Rectangle iconR, 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. Locations are computed relative to the viewR rectangle. This layoutCompoundLabel() does not know how to handle LEADING/TRAILING values in horizontalTextPosition (they will default to RIGHT) and in horizontalAlignment (they will default to CENTER). Use the other version of layoutCompoundLabel() instead.
-
configureGraphics
public static void configureGraphics(Graphics gr)
-
-