Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jdesktop.swingx
Class SwingXUtilities

    java.lang.Object
      org.jdesktop.swingx.SwingXUtilities

    public final class SwingXUtilities

extends java.lang.Object

A collection of utility methods for Swing(X) classes.

PENDING JW: think about location of this class and/or its methods, Options:
- move this class to the swingx utils package which already has a bunch of xxUtils
- move methods between xxUtils classes as appropriate (one window/comp related util)
- keep here in swingx (consistent with swingutilities in core)

Author:
  Karl George Schaefer

Method Summary
`static void` | `adjustFocus(javax.swing.JComponent component)`
`static int` | `convertModifiersToDropAction(int modifiers, int sourcActions)`
`static
`<T> T`
` | `getAncestor(java.lang.Class<T> clazz, java.awt.Component c)` An improved version of `SwingUtilities.getAncestorOfClass(Class, Component)`.
`static boolean` | `isDescendingFrom(java.awt.Component focusOwner, java.awt.Component parent)` Returns whether the component is part of the parent's container hierarchy.
`static boolean` | `isUIInstallable(java.lang.Object property)` Checks and returns whether the given property should be replaced by the UI's default value.
`static int` | `loc2IndexFileList(javax.swing.JList list, java.awt.Point point)`
`static void` | `setComponentTreeBackground(java.awt.Component c, java.awt.Color color)` Sets the background for an entire component hierarchy to the specified color.
`static void` | `setComponentTreeEnabled(java.awt.Component c, boolean enabled)` Enables or disables of the components in the tree starting with `c`.
`static void` | `setComponentTreeFont(java.awt.Component c, java.awt.Font font)` Sets the font for an entire component hierarchy to the specified font.
`static void` | `setComponentTreeForeground(java.awt.Component c, java.awt.Color color)` Sets the foreground for an entire component hierarchy to the specified color.
`static void` | `setComponentTreeLocale(java.awt.Component c, java.util.Locale locale)` Sets the locale for an entire component hierarchy to the specified locale.
`static void` | `setHtmlFont(javax.swing.text.html.HTMLDocument doc, java.awt.Font font)` Sets the font used for HTML displays to the specified font.
`static void` | `setLeadAnchorWithoutSelection(javax.swing.ListSelectionModel selectionModel, int lead, int anchor)` Updates lead and anchor selection index without changing the selection.
`static boolean` | `shouldIgnore(java.awt.event.MouseEvent mouseEvent, javax.swing.JComponent component)`
`static void` | `updateAllComponentTreeUIs()` Updates the componentTreeUI of all top-level windows of the current application.
`static void` | `updateAllComponentTreeUIs(java.awt.Window window)` Updates the componentTreeUI of the given window and all its owned windows, recursively.
`static void` | `updateMnemonicBinding(javax.swing.JComponent c, java.lang.String pressed)` A helper for creating and updating key bindings for components with mnemonics.
`static void` | `updateMnemonicBinding(javax.swing.JComponent c, java.lang.String pressed, java.lang.String released)` A helper for creating and updating key bindings for components with mnemonics.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### updateMnemonicBinding

    public static void updateMnemonicBinding(javax.swing.JComponent c,
                                             java.lang.String pressed)

  A helper for creating and updating key bindings for components with mnemonics. The `pressed` action will be invoked when the mnemonic is activated.

  TODO establish an interface for the mnemonic properties, such as `MnemonicEnabled` and change signature to `public static <T extends JComponent & MnemonicEnabled> void updateMnemonicBinding(T c, String pressed)`

  Parameters:
    `c` - the component bindings to update
    `pressed` - the name of the action in the action map to invoke when the mnemonic is pressed
  Throws:
    `java.lang.NullPointerException` - if the component is `null`

### updateMnemonicBinding

    public static void updateMnemonicBinding(javax.swing.JComponent c,
                                             java.lang.String pressed,
                                             java.lang.String released)

  A helper for creating and updating key bindings for components with mnemonics. The `pressed` action will be invoked when the mnemonic is activated and the `released` action will be invoked when the mnemonic is deactivated.

  TODO establish an interface for the mnemonic properties, such as `MnemonicEnabled` and change signature to `public static <T extends JComponent & MnemonicEnabled> void updateMnemonicBinding(T c, String pressed, String released)`

  Parameters:
    `c` - the component bindings to update
    `pressed` - the name of the action in the action map to invoke when the mnemonic is pressed
    `released` - the name of the action in the action map to invoke when the mnemonic is released (if the action is a toggle style, then this parameter should be `null`)
  Throws:
    `java.lang.NullPointerException` - if the component is `null`

### setComponentTreeEnabled

    public static void setComponentTreeEnabled(java.awt.Component c,
                                               boolean enabled)

  Enables or disables of the components in the tree starting with `c`.

  Parameters:
    `c` - the starting component
    `enabled` - `true` if the component is to enabled; `false` otherwise

### setComponentTreeLocale

    public static void setComponentTreeLocale(java.awt.Component c,
                                              java.util.Locale locale)

  Sets the locale for an entire component hierarchy to the specified locale.

  Parameters:
    `c` - the starting component
    `locale` - the locale to set

### setComponentTreeBackground

    public static void setComponentTreeBackground(java.awt.Component c,
                                                  java.awt.Color color)

  Sets the background for an entire component hierarchy to the specified color.

  Parameters:
    `c` - the starting component
    `color` - the color to set

### setComponentTreeForeground

    public static void setComponentTreeForeground(java.awt.Component c,
                                                  java.awt.Color color)

  Sets the foreground for an entire component hierarchy to the specified color.

  Parameters:
    `c` - the starting component
    `color` - the color to set

### setComponentTreeFont

    public static void setComponentTreeFont(java.awt.Component c,
                                            java.awt.Font font)

  Sets the font for an entire component hierarchy to the specified font.

  Parameters:
    `c` - the starting component
    `font` - the font to set

### setHtmlFont

    public static void setHtmlFont(javax.swing.text.html.HTMLDocument doc,
                                   java.awt.Font font)

  Sets the font used for HTML displays to the specified font. Components that display HTML do not necessarily honor font properties, since the HTML document can override these values. Calling `setHtmlFont` after the data is set will force the HTML display to use the font specified to this method.

  Parameters:
    `doc` - the HTML document to update
    `font` - the font to use
  Throws:
    `java.lang.NullPointerException` - if any parameter is `null`

### updateAllComponentTreeUIs

    public static void updateAllComponentTreeUIs()

  Updates the componentTreeUI of all top-level windows of the current application.

### updateAllComponentTreeUIs

    public static void updateAllComponentTreeUIs(java.awt.Window window)

  Updates the componentTreeUI of the given window and all its owned windows, recursively.

  Parameters:
    `window` - the window to update

### getAncestor

    public static <T> T getAncestor(java.lang.Class<T> clazz,
                                    java.awt.Component c)

  An improved version of `SwingUtilities.getAncestorOfClass(Class, Component)`. This method traverses `JPopupMenu` invoker and uses generics to return an appropriately typed object.

  Type Parameters:
    `T` - the type of ancestor to find
  Parameters:
    `clazz` - the class instance of the ancestor to find
    `c` - the component to start the search from
  Returns:
    an ancestor of the correct type or `null` if no such ancestor exists. This method also returns `null` if any parameter is `null`.

### isDescendingFrom

    public static boolean isDescendingFrom(java.awt.Component focusOwner,
                                           java.awt.Component parent)

  Returns whether the component is part of the parent's container hierarchy. If a parent in the chain is of type JPopupMenu, the parent chain of its invoker is walked.

  Parameters:
    `focusOwner` -
    `parent` -
  Returns:
    true if the component is contained under the parent's hierarchy, coping with JPopupMenus.

### isUIInstallable

    public static boolean isUIInstallable(java.lang.Object property)

  Checks and returns whether the given property should be replaced by the UI's default value.

  Parameters:
    `property` - the property to check.
  Returns:
    true if the given property should be replaced by the UI's default value, false otherwise.

### setLeadAnchorWithoutSelection

    public static void setLeadAnchorWithoutSelection(javax.swing.ListSelectionModel selectionModel,
                                                     int lead,
                                                     int anchor)

  Updates lead and anchor selection index without changing the selection. Note: this is c&p'ed from SwingUtilities2 to not have any direct dependency.

  Parameters:
    `selectionModel` - the selection model to change lead/anchor
    `lead` - the lead selection index
    `anchor` - the anchor selectin index

### shouldIgnore

    public static boolean shouldIgnore(java.awt.event.MouseEvent mouseEvent,
                                       javax.swing.JComponent component)

### loc2IndexFileList

    public static int loc2IndexFileList(javax.swing.JList list,
                                        java.awt.Point point)

### adjustFocus

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

### convertModifiersToDropAction

    public static int convertModifiersToDropAction(int modifiers,
                                                   int sourcActions)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2010. All Rights Reserved.