Package org.flexdock.util
Class SwingUtility
- java.lang.Object
-
- org.flexdock.util.SwingUtility
-
public class SwingUtility extends java.lang.Object
- Author:
- Christopher Butler
-
-
Constructor Summary
Constructors Constructor Description SwingUtility()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description 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 suppliedJSplitPane
divider to the specifiedproportion
.static void
subtract(java.awt.Point p1, java.awt.Point p2)
static java.awt.Component
toComponent(java.lang.Object obj)
static void
toggleFocus(int direction)
static void
translate(java.awt.Component src, java.awt.Polygon poly, java.awt.Component dest)
-
-
-
Method Detail
-
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]
-
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)
-
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()
-
getSplitPaneSize
public static int getSplitPaneSize(javax.swing.JSplitPane splitPane)
-
setSplitDivider
public static void setSplitDivider(javax.swing.JSplitPane split, float proportion)
Moves the suppliedJSplitPane
divider to the specifiedproportion
. Valid values forproportion
range from0.0F
is used. If ato
0.0F1.0F
. For example, aproportion
of0.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 specifiedDockable
. If aproportion
of less than0.0F
is supplied, the valueproportion
greater than1.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 unrealizedComponent
dimensions, which are initially0x0
before theComponent
has been rendered to the screen.
If the specifiedJSplitPane
isnull
, then this method returns with no action taken.- Parameters:
split
- theJSplitPane
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)
-
-