org.flexdock.util
Class SwingUtility
java.lang.Object
org.flexdock.util.SwingUtility
public class SwingUtility
- extends Object
- Author:
- Christopher Butler
Method Summary |
static void |
activateWindow(Component c)
|
static void |
add(Point p1,
Point p2)
|
static Color |
brighter(Color color,
double factor)
|
static void |
center(Window window,
Component parent)
|
static void |
centerOnScreen(Window window)
|
static BufferedImage |
createImage(Component comp)
|
static Color |
darker(Color color,
double factor)
|
static void |
drawRect(Graphics g,
Rectangle r)
|
static void |
focus(Component c)
|
static Window |
getActiveWindow()
|
static DockingPort[] |
getChildPorts(DockingPort port)
|
static Object |
getClientProperty(Component c,
Object key)
|
static Container |
getContentPane(Component c)
|
static float |
getDividerProportion(JSplitPane splitPane)
|
static Component |
getNearestFocusableComponent(Component c)
|
static Component |
getNearestFocusableComponent(Component c,
Container desiredRoot)
|
static Component |
getOtherComponent(JSplitPane split,
Component current)
|
static Point[] |
getPoints(Rectangle rect)
|
static Point[] |
getPoints(Rectangle rect,
Component convertFromScreen)
|
static int |
getSplitPaneSize(JSplitPane splitPane)
|
static Color |
grayScale(Color color)
|
static boolean |
isSkinLFInstalled()
|
static void |
putClientProperty(Component c,
Object key,
Object value)
|
static void |
removeClientProperty(Component c,
Object key)
|
static void |
repaint(Component comp)
|
static void |
revalidate(Component comp)
|
static void |
setPlaf(Class lookAndFeelClass)
|
static void |
setPlaf(String lookAndFeelClassName)
|
static void |
setSplitDivider(JSplitPane split,
float proportion)
Moves the supplied JSplitPane divider to the specified proportion . |
static void |
subtract(Point p1,
Point p2)
|
static Component |
toComponent(Object obj)
|
static void |
toggleFocus(int direction)
|
static void |
translate(Component src,
Polygon poly,
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 Component toComponent(Object obj)
revalidate
public static void revalidate(Component comp)
repaint
public static void repaint(Component comp)
drawRect
public static void drawRect(Graphics g,
Rectangle r)
getChildPorts
public static DockingPort[] getChildPorts(DockingPort port)
getPoints
public static Point[] getPoints(Rectangle rect)
getPoints
public static Point[] getPoints(Rectangle rect,
Component convertFromScreen)
centerOnScreen
public static final void centerOnScreen(Window window)
center
public static void center(Window window,
Component parent)
getContentPane
public static Container getContentPane(Component c)
setPlaf
public static void setPlaf(Class lookAndFeelClass)
setPlaf
public static void setPlaf(String lookAndFeelClassName)
add
public static void add(Point p1,
Point p2)
subtract
public static void subtract(Point p1,
Point p2)
translate
public static void translate(Component src,
Polygon poly,
Component dest)
focus
public static void focus(Component c)
getNearestFocusableComponent
public static Component getNearestFocusableComponent(Component c)
getNearestFocusableComponent
public static Component getNearestFocusableComponent(Component c,
Container desiredRoot)
activateWindow
public static void activateWindow(Component c)
brighter
public static Color brighter(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 Color darker(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 Color grayScale(Color color)
- Parameters:
color
-
- Returns:
- the grey color corresponding to the color passed as parameter
author Cyril Gambis - [Mar 17, 2005]
createImage
public static BufferedImage createImage(Component comp)
getDividerProportion
public static float getDividerProportion(JSplitPane splitPane)
getOtherComponent
public static Component getOtherComponent(JSplitPane split,
Component current)
putClientProperty
public static void putClientProperty(Component c,
Object key,
Object value)
getClientProperty
public static Object getClientProperty(Component c,
Object key)
removeClientProperty
public static void removeClientProperty(Component c,
Object key)
getActiveWindow
public static Window getActiveWindow()
getSplitPaneSize
public static int getSplitPaneSize(JSplitPane splitPane)
setSplitDivider
public static void setSplitDivider(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()
toggleFocus
public static void toggleFocus(int direction)