Overview | Package | Class | Use | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## contrib.ch.randelshofer.quaqua
Class QuaquaUtilities

    java.lang.Object
      javax.swing.plaf.basic.BasicGraphicsUtils
          contrib.ch.randelshofer.quaqua.QuaquaUtilities

All Implemented Interfaces:
  javax.swing.SwingConstants

    public class QuaquaUtilities

extends javax.swing.plaf.basic.BasicGraphicsUtils
implements javax.swing.SwingConstants

Utility class for the Quaqua LAF.

Version:
  3.1 2006-09-04 Added method compositeRequestFocus.
  3.0.5 2006-08-20 Method endGraphics must not set KEY_TEXT_ANTIALIASING to null.
  3.0.4 2006-02-19 Catch Throwable in method setWindowAlpha instead of catching NoSuchMethodException.
  3.0.3 2006-01-08 Don't set Window alpha, when running on Java 1.4.2_05 on Mac OS X 10.3.5. Because this only has the effect of turning the background color of the Window to white.
  3.0.2 2005-12-10 Method isOnActiveWindow() did not reliably return true.
  3.0.1 2005-11-12 Fixed NPE in method repaint border.
  3.0 2005-09-24 Removed all reflection helper methods. Moved Sheet helper methods out into class Sheets.
  2.6 2005-09-17 Method isOnFocusedWindow returns true, if the window returns false on "getFocusableWindowState".
  2.5 2005-03-13 Renamed method isFrameActive to isOnActiveFrame.
  2.4 2004-12-28 Method createBufferdImage added. Method isOnActiveWindow() renamed to isFrameActive().
  2.3 2004-12-14 Method getUI added.
  2.2.1 2004-12-01 Methods setDragEnabled and getDragEnabled never worked because the attempted to get method objects on the wrong class.
  2.2 2004-09-19 Refined algorithm of method isFrameActive.
  2.1 2004-07-04 Methods repaintBorder, beginFont, endFont and isFocused added.
  2.0 2004-04-27 Renamed from QuaquaGraphicUtils to QuaquaUtilities. Added method isFrameActive(Component).
  1.1.1 2003-10-08 Diagnostic output to System.out removed.
  1.1 2003-10-05 Methods getModifiersText and getModifiersUnicode added.
  1.0 2003-07-19 Created.
Author:
  Werner Randelshofer, Staldenmattweg 2, CH-6405 Immensee, Switzerland

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 java.lang.Object` | `beginGraphics(java.awt.Graphics2D graphics2d)`
`static java.awt.Component` | `compositeRequestFocus(java.awt.Component component)` Copied from BasicLookAndFeel.
`static void` | `configureGraphics(java.awt.Graphics gr)`
`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)`
`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 boolean` | `isFocused(java.awt.Component component)`
`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 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 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

### isLeftToRight

    public static boolean isLeftToRight(java.awt.Component c)

### drawStringUnderlineCharAt

    public 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. The character at index `underlinedIndex` in text will be underlined. If `index` is beyond the bounds of `text` (including < 0), nothing will be underlined.

  Parameters:
    `g` - Graphics to draw with
    `text` - String to draw
    `underlinedIndex` - Index of character in text to underline
    `x` - x coordinate to draw at
    `y` - y coordinate to draw at
  Since:
    1.4

### isOnActiveWindow

    public 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. Always returns true, if the component has no parent window.

### getKeyModifiersText

    public 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".

  Returns:
    string a text description of the combination of modifier keys that were held down during the event

### repaintBorder

    public static void repaintBorder(javax.swing.JComponent component)

### beginGraphics

    public static final java.lang.Object beginGraphics(java.awt.Graphics2D graphics2d)

### endGraphics

    public static final void endGraphics(java.awt.Graphics2D graphics2d,
                                         java.lang.Object oldHints)

### isFocused

    public static final boolean isFocused(java.awt.Component component)

### getLeftSideBearing

    public static int getLeftSideBearing(java.awt.Font f,
                                         java.lang.String string)

### createBufferedImage

    public static java.awt.image.BufferedImage createBufferedImage(java.net.URL location)

### createTexturePaint

    public static java.awt.TexturePaint createTexturePaint(java.net.URL location)

### layoutCompoundLabel

    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)

  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 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. 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(java.awt.Graphics gr)

### compositeRequestFocus

    public static java.awt.Component compositeRequestFocus(java.awt.Component component)

  Copied from BasicLookAndFeel.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD