org.noos.xing.mydoggy.plaf.ui.util
Class SwingUtil

java.lang.Object
  extended by org.noos.xing.mydoggy.plaf.ui.util.SwingUtil

public class SwingUtil
extends Object

Author:
Angelo De Caro

Nested Class Summary
static class SwingUtil.DragEntry
           
 
Method Summary
static void addKeyActionMapping(int condition, JComponent component, KeyStroke keyStroke, Object actionMapKey, Action action)
           
static void addKeyActionMapping(JComponent component, KeyStroke keyStroke, Object actionMapKey, Action action)
           
static void centrePositionOnScreen(Window window)
           
static Point convertPoint(Component source, Point aPoint, Component destination)
           
static Point convertPointFromScreen(Point p, Component c)
           
static Point convertPointFromScreen2(Point p, Component c)
           
static void convertPointToScreen(Point p, Component c)
          Convert a point from a component's coordinate system to screen coordinates.
static void dispatchEvent(Object src, AWTEvent event)
           
static Component findAndRequestFocus(Component component)
           
static Component findComponentAt(Container cont, int x, int y)
           
static Component findComponentAt(Container cont, int x, int y, boolean ignoreEnabled, boolean ignoreGlassPane)
           
static int findDisplayedMnemonicIndex(String text, int mnemonic)
           
static Component findFocusable(Component cmp)
           
static
<T> T
getAt(PropertyChangeEvent e, int index, T defaultValue)
           
static boolean getBoolean(String name, boolean defaultValue)
           
static Border getBorder(String key, Border border)
           
static
<T> T
getClientProperty(JComponent c, Object key)
           
static Color getColor(String key, Color defaultColor)
           
static Component getComponentWhoseParentIs(Component c, Component p)
           
static List<ContentWindow> getContentWindows()
           
static Object getDeepestObjectAt(Object parent, int x, int y)
           
static float getFloat(String name, float defaultValue)
           
static int getIconHeight(Icon icon)
           
static int getIconWidth(Icon icon)
           
static BufferedImage getImage(String name)
           
static int getInt(PropertyChangeEvent e, int defaultValue)
           
static int getInt(String name, int defaultValue)
           
static List<Window> getMyDoggyTopContainers()
           
static
<T> T
getParent(Component c, Class<? extends T> parentClass)
           
static Component getParent(Component c, String parentName)
           
static
<T> T
getParentClientProperty(Component c, Class<? extends T> propertyIdClass)
           
static ResourceBundle getResourceBundle()
           
static Rectangle getScreenWindowBounds(Window window)
           
static String getString(String key)
           
static List<Window> getTopContainers()
           
static List<Window> getTopContainers(String name)
           
static TransparencyManager<Window> getTransparencyManager()
           
static URL getUrl(ClassLoader classLoader, String url)
           
static String getUserString(String key)
           
static Rectangle getVirtualScreenBounds()
           
static Component getWindowAncestor(Component c)
           
static boolean hasParent(Component component, Component parent)
           
static void installBorder(JComponent c, String defaultBorderName)
           
static void installColors(JComponent c, String defaultBgName, String defaultFgName)
           
static void installColorsAndFont(JComponent c, String defaultBgName, String defaultFgName, String defaultFontName)
           
static void installFont(JComponent component, String name)
           
static boolean isAncestor(Component component, Component parent)
           
static boolean isLeftToRight(Component c)
           
static Icon loadIcon(ClassLoader classLoader, String urlDef)
           
static Icon loadIcon(String urlDef)
           
static Image loadImage(String url)
           
static BufferedImage loadImageIO(String url)
           
static Properties loadPropertiesFile(String resourceName, ClassLoader classLoader)
           
static Object newObject(ClassLoader classLoader, String className)
           
static DragGestureRecognizer registerDragListener(Component c, DragListener dragListener)
           
static void repaint(Component component)
           
static void repaint(Component component, Runnable runnable)
           
static void repaintNow(Component component)
           
static void requestFocus(Component component)
           
static void restoreFullScreenWindow(Window window)
           
static void revalidate(Component component)
           
static void revalidate(JComponent component)
           
static void setFullScreen(Window window)
           
static void setWindowTitle(Component component, String title)
           
static String space(int level)
           
static String toString(PropertyChangeEvent event)
           
static void unregisterDragListener(Component c)
           
static void unregisterDragListener(DragGestureRecognizer recognizer, DragListener dragListener)
           
static void updateComponentTreeUI(Component c)
          A simple minded look and feel change: ask each node in the tree to updateUI() -- that is, to initialize its UI property with the current look and feel.
static void validateBounds(Component component)
           
static void validateBounds(Component component, Rectangle referenceBounds)
           
static Rectangle validateBounds(Rectangle bounds)
           
static Rectangle validateBounds(Rectangle bounds, Rectangle referenceBounds)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

repaint

public static void repaint(Component component)

repaint

public static void repaint(Component component,
                           Runnable runnable)

repaintNow

public static void repaintNow(Component component)

revalidate

public static void revalidate(Component component)

revalidate

public static void revalidate(JComponent component)

getTopContainers

public static List<Window> getTopContainers(String name)

getTopContainers

public static List<Window> getTopContainers()

getMyDoggyTopContainers

public static List<Window> getMyDoggyTopContainers()

getContentWindows

public static List<ContentWindow> getContentWindows()

getDeepestObjectAt

public static Object getDeepestObjectAt(Object parent,
                                        int x,
                                        int y)

findComponentAt

public static Component findComponentAt(Container cont,
                                        int x,
                                        int y)

findComponentAt

public static Component findComponentAt(Container cont,
                                        int x,
                                        int y,
                                        boolean ignoreEnabled,
                                        boolean ignoreGlassPane)

findFocusable

public static Component findFocusable(Component cmp)

requestFocus

public static void requestFocus(Component component)

findAndRequestFocus

public static Component findAndRequestFocus(Component component)

hasParent

public static boolean hasParent(Component component,
                                Component parent)

isAncestor

public static boolean isAncestor(Component component,
                                 Component parent)

getParent

public static Component getParent(Component c,
                                  String parentName)

getParent

public static <T> T getParent(Component c,
                              Class<? extends T> parentClass)

getParentClientProperty

public static <T> T getParentClientProperty(Component c,
                                            Class<? extends T> propertyIdClass)

getComponentWhoseParentIs

public static Component getComponentWhoseParentIs(Component c,
                                                  Component p)

getWindowAncestor

public static Component getWindowAncestor(Component c)

loadIcon

public static Icon loadIcon(String urlDef)

loadIcon

public static Icon loadIcon(ClassLoader classLoader,
                            String urlDef)

loadImage

public static Image loadImage(String url)

loadImageIO

public static BufferedImage loadImageIO(String url)

convertPointToScreen

public static void convertPointToScreen(Point p,
                                        Component c)
Convert a point from a component's coordinate system to screen coordinates.

Parameters:
p - a Point object (converted to the new coordinate system)
c - a Component object

getVirtualScreenBounds

public static Rectangle getVirtualScreenBounds()

validateBounds

public static Rectangle validateBounds(Rectangle bounds,
                                       Rectangle referenceBounds)

validateBounds

public static Rectangle validateBounds(Rectangle bounds)

validateBounds

public static void validateBounds(Component component)

validateBounds

public static void validateBounds(Component component,
                                  Rectangle referenceBounds)

setFullScreen

public static void setFullScreen(Window window)

restoreFullScreenWindow

public static void restoreFullScreenWindow(Window window)

getScreenWindowBounds

public static Rectangle getScreenWindowBounds(Window window)

loadPropertiesFile

public static Properties loadPropertiesFile(String resourceName,
                                            ClassLoader classLoader)

newObject

public static Object newObject(ClassLoader classLoader,
                               String className)

toString

public static String toString(PropertyChangeEvent event)

getUrl

public static URL getUrl(ClassLoader classLoader,
                         String url)

registerDragListener

public static DragGestureRecognizer registerDragListener(Component c,
                                                         DragListener dragListener)

unregisterDragListener

public static void unregisterDragListener(DragGestureRecognizer recognizer,
                                          DragListener dragListener)

unregisterDragListener

public static void unregisterDragListener(Component c)

addKeyActionMapping

public static void addKeyActionMapping(JComponent component,
                                       KeyStroke keyStroke,
                                       Object actionMapKey,
                                       Action action)

addKeyActionMapping

public static void addKeyActionMapping(int condition,
                                       JComponent component,
                                       KeyStroke keyStroke,
                                       Object actionMapKey,
                                       Action action)

centrePositionOnScreen

public static void centrePositionOnScreen(Window window)

isLeftToRight

public static boolean isLeftToRight(Component c)

dispatchEvent

public static void dispatchEvent(Object src,
                                 AWTEvent event)

getIconWidth

public static int getIconWidth(Icon icon)

getIconHeight

public static int getIconHeight(Icon icon)

findDisplayedMnemonicIndex

public static int findDisplayedMnemonicIndex(String text,
                                             int mnemonic)

convertPointFromScreen

public static Point convertPointFromScreen(Point p,
                                           Component c)

convertPointFromScreen2

public static Point convertPointFromScreen2(Point p,
                                            Component c)

convertPoint

public static Point convertPoint(Component source,
                                 Point aPoint,
                                 Component destination)

setWindowTitle

public static void setWindowTitle(Component component,
                                  String title)

installFont

public static void installFont(JComponent component,
                               String name)

getClientProperty

public static final <T> T getClientProperty(JComponent c,
                                            Object key)

getBoolean

public static boolean getBoolean(String name,
                                 boolean defaultValue)

getImage

public static BufferedImage getImage(String name)

getFloat

public static float getFloat(String name,
                             float defaultValue)

getInt

public static int getInt(String name,
                         int defaultValue)

getColor

public static Color getColor(String key,
                             Color defaultColor)

getTransparencyManager

public static TransparencyManager<Window> getTransparencyManager()

getBorder

public static Border getBorder(String key,
                               Border border)

getResourceBundle

public static ResourceBundle getResourceBundle()

getString

public static String getString(String key)

getUserString

public static String getUserString(String key)

getInt

public static int getInt(PropertyChangeEvent e,
                         int defaultValue)

getAt

public static <T> T getAt(PropertyChangeEvent e,
                          int index,
                          T defaultValue)

updateComponentTreeUI

public static void updateComponentTreeUI(Component c)
A simple minded look and feel change: ask each node in the tree to updateUI() -- that is, to initialize its UI property with the current look and feel.


space

public static String space(int level)

installColorsAndFont

public static void installColorsAndFont(JComponent c,
                                        String defaultBgName,
                                        String defaultFgName,
                                        String defaultFontName)

installColors

public static void installColors(JComponent c,
                                 String defaultBgName,
                                 String defaultFgName)

installBorder

public static void installBorder(JComponent c,
                                 String defaultBorderName)


Copyright © 2012. All Rights Reserved.