org.flexdock.util
Class SwingUtility
java.lang.Object
org.flexdock.util.SwingUtility
public class SwingUtility
- extends java.lang.Object
- Author:
- Christopher Butler
Method Summary |
static void |
activateWindow(java.awt.Component c)
|
static void |
add(java.awt.Point p1,
java.awt.Point p2)
|
static java.awt.Color |
brighter(java.awt.Color color,
double factor)
|
static void |
center(java.awt.Window window,
java.awt.Component parent)
|
static void |
centerOnScreen(java.awt.Window window)
|
static java.awt.image.BufferedImage |
createImage(java.awt.Component comp)
|
static java.awt.Color |
darker(java.awt.Color color,
double factor)
|
static void |
drawRect(java.awt.Graphics g,
java.awt.Rectangle r)
|
static void |
focus(java.awt.Component c)
|
static java.awt.Window |
getActiveWindow()
|
static DockingPort[] |
getChildPorts(DockingPort port)
|
static java.lang.Object |
getClientProperty(java.awt.Component c,
java.lang.Object key)
|
static java.awt.Container |
getContentPane(java.awt.Component c)
|
static float |
getDividerProportion(javax.swing.JSplitPane splitPane)
|
static java.awt.Component |
getNearestFocusableComponent(java.awt.Component c)
|
static java.awt.Component |
getNearestFocusableComponent(java.awt.Component c,
java.awt.Container desiredRoot)
|
static java.awt.Component |
getOtherComponent(javax.swing.JSplitPane split,
java.awt.Component current)
|
static java.awt.Point[] |
getPoints(java.awt.Rectangle rect)
|
static java.awt.Point[] |
getPoints(java.awt.Rectangle rect,
java.awt.Component convertFromScreen)
|
static int |
getSplitPaneSize(javax.swing.JSplitPane splitPane)
|
static java.awt.Color |
grayScale(java.awt.Color color)
|
static boolean |
isSkinLFInstalled()
|
static void |
putClientProperty(java.awt.Component c,
java.lang.Object key,
java.lang.Object value)
|
static void |
removeClientProperty(java.awt.Component c,
java.lang.Object key)
|
static void |
repaint(java.awt.Component comp)
|
static void |
revalidate(java.awt.Component comp)
|
static void |
setPlaf(java.lang.Class lookAndFeelClass)
|
static void |
setPlaf(java.lang.String lookAndFeelClassName)
|
static void |
setSplitDivider(javax.swing.JSplitPane split,
float proportion)
Moves the supplied JSplitPane divider to the specified proportion . |
static void |
subtract(java.awt.Point p1,
java.awt.Point p2)
|
static java.awt.Component |
toComponent(java.lang.Object obj)
|
static void |
translate(java.awt.Component src,
java.awt.Polygon poly,
java.awt.Component dest)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SwingUtility
public SwingUtility()
toComponent
public static java.awt.Component toComponent(java.lang.Object obj)
revalidate
public static void revalidate(java.awt.Component comp)
repaint
public static void repaint(java.awt.Component comp)
drawRect
public static void drawRect(java.awt.Graphics g,
java.awt.Rectangle r)
getChildPorts
public static DockingPort[] getChildPorts(DockingPort port)
getPoints
public static java.awt.Point[] getPoints(java.awt.Rectangle rect)
getPoints
public static java.awt.Point[] getPoints(java.awt.Rectangle rect,
java.awt.Component convertFromScreen)
centerOnScreen
public static final void centerOnScreen(java.awt.Window window)
center
public static void center(java.awt.Window window,
java.awt.Component parent)
getContentPane
public static java.awt.Container getContentPane(java.awt.Component c)
setPlaf
public static void setPlaf(java.lang.Class lookAndFeelClass)
setPlaf
public static void setPlaf(java.lang.String lookAndFeelClassName)
add
public static void add(java.awt.Point p1,
java.awt.Point p2)
subtract
public static void subtract(java.awt.Point p1,
java.awt.Point p2)
translate
public static void translate(java.awt.Component src,
java.awt.Polygon poly,
java.awt.Component dest)
focus
public static void focus(java.awt.Component c)
getNearestFocusableComponent
public static java.awt.Component getNearestFocusableComponent(java.awt.Component c)
getNearestFocusableComponent
public static java.awt.Component getNearestFocusableComponent(java.awt.Component c,
java.awt.Container desiredRoot)
activateWindow
public static void activateWindow(java.awt.Component c)
brighter
public static java.awt.Color brighter(java.awt.Color color,
double factor)
- Parameters:
color
- factor
-
- Returns:
- a new color, brighter than the one passed as argument by a percentage factor
author Cyril Gambis - [Mar 17, 2005]
darker
public static java.awt.Color darker(java.awt.Color color,
double factor)
- Parameters:
color
- factor
-
- Returns:
- a new color, darker than the one passed as argument by a percentage factor
author Cyril Gambis - [Mar 17, 2005]
grayScale
public static java.awt.Color grayScale(java.awt.Color color)
- Parameters:
color
-
- Returns:
- the grey color corresponding to the color passed as parameter
author Cyril Gambis - [Mar 17, 2005]
putClientProperty
public static void putClientProperty(java.awt.Component c,
java.lang.Object key,
java.lang.Object value)
getClientProperty
public static java.lang.Object getClientProperty(java.awt.Component c,
java.lang.Object key)
removeClientProperty
public static void removeClientProperty(java.awt.Component c,
java.lang.Object key)
getActiveWindow
public static java.awt.Window getActiveWindow()
createImage
public static java.awt.image.BufferedImage createImage(java.awt.Component comp)
getDividerProportion
public static float getDividerProportion(javax.swing.JSplitPane splitPane)
getOtherComponent
public static java.awt.Component getOtherComponent(javax.swing.JSplitPane split,
java.awt.Component current)
getSplitPaneSize
public static int getSplitPaneSize(javax.swing.JSplitPane splitPane)
setSplitDivider
public static void setSplitDivider(javax.swing.JSplitPane split,
float proportion)
- Moves the supplied
JSplitPane
divider to the specified proportion
.
Valid values for proportion
range from 0.0F
to 1.0F
. For example, a proportion
of 0.3F
will move the
divider to 30% of the "size" (width for horizontal split, height for vertical split) of the
split container that contains the specified Dockable
. If a proportion
of less
than 0.0F
is supplied, the value
0.0F
is used. If a proportion
greater than 1.0F
is supplied, the value 1.0F is used.
This method should be effective regardless of whether the split layout in question has been fully realized
and is currently visible on the screen. This should alleviate common problems associated with setting
percentages of unrealized Component
dimensions, which are initially 0x0
before
the Component
has been rendered to the screen.
If the specified JSplitPane
is null
, then this method returns with no action
taken.
- Parameters:
split
- the JSplitPane
whose divider location is to be set.proportion
- a double-precision floating point value that specifies a percentage,
from zero (top/left) to 1.0 (bottom/right)- See Also:
getSplitPaneSize(JSplitPane)
,
JSplitPane.setDividerLocation(double)
isSkinLFInstalled
public static boolean isSkinLFInstalled()