public class GuiUtil
extends java.lang.Object
Constructor and Description |
---|
GuiUtil() |
Modifier and Type | Method and Description |
---|---|
static java.awt.Point |
centerOf(java.awt.Rectangle r)
Returns the center Point of the given rectangle.
|
static java.awt.Point |
checkInRange(java.awt.Point point,
java.awt.Dimension dim)
Checks whether the given Point is positioned within the given Dimension.
|
static void |
checkIsEventDispatchThread() |
static void |
exitLater(int exitCode)
Schedules a System.exit() call to the event dispatcher for delayed execution
|
static java.awt.Rectangle |
getBoundsOf(java.awt.Point[] points)
Returns the Rectangle that encloses all given Points.
|
static java.awt.RenderingHints |
getDefaultRenderingHints() |
static java.awt.Color |
getLabelColorFor(java.awt.Color bg)
Returns either black or white as label color dependent on the lightness of the given background color.
|
static java.awt.Dimension |
getMaximumScreenDimension() |
static java.awt.Window |
getRootContainerOf(javax.swing.JComponent comp)
Finds out the root container in which the given component resides.
|
static int |
getStringWidth(java.awt.Font font,
java.lang.String str) |
static int |
getStringWidth(javax.swing.JComponent comp,
int numChars) |
static int |
getStringWidth(javax.swing.JComponent comp,
java.lang.String s) |
static boolean |
isInSnapRange(java.awt.Point mousePoint,
java.awt.Point posPoint,
int snapRange)
Tells whether the given Points are within the given snap range.
|
static boolean |
isPopupTrigger(java.awt.event.MouseEvent e) |
static boolean |
isSelectionTrigger(java.awt.event.MouseEvent e) |
static void |
locateWindow(ToolWindow win,
java.awt.Component comp,
WindowAlignment alignment) |
static void |
locateWindow(java.awt.Window win,
int newX,
int newY)
Moves the given window by the given deltaX and deltaY values
|
static javax.swing.border.Border |
marginizeBorder(javax.swing.border.Border border,
java.awt.Insets ins)
Creates a compound border such that the given border is inlined with the given Insets.
|
static java.awt.Dimension |
maxOf(java.awt.Dimension d1,
java.awt.Dimension d2)
Returns a Dimension containing the maximum width and height of the given dimensions.
|
static void |
popWindowToFrontOf(javax.swing.JComponent comp) |
static void |
setFieldColor(java.awt.Component comp,
java.awt.Color bg)
Sets the background for the given component and adapts the foreground such that a lable remains readable on it's background
|
static void |
setToSameHeight(javax.swing.JComponent... components)
Ensures that all components have got the same hight, which is the height of the highest component in the array.
|
static void |
setToSameSize(javax.swing.JComponent... components)
Sets the preferred size of all components to the one of the biggest in the array.
|
static void |
setToSameWidth(javax.swing.JComponent... components)
Ensures that all components have got the same width, which is the width of the widest component in the array.
|
static void |
shiftWindow(java.awt.Window win,
int deltaX,
int deltaY)
Moves the given window by the given deltaX and deltaY values
|
static java.awt.Point |
validatePoint(java.awt.Point p)
Checks the validity of the given Point.
|
static java.awt.Rectangle |
validateRect(java.awt.Rectangle r)
Checks the validity of the given Rectangle.
|
public static java.awt.RenderingHints getDefaultRenderingHints()
public static boolean isPopupTrigger(java.awt.event.MouseEvent e)
public static boolean isSelectionTrigger(java.awt.event.MouseEvent e)
public static java.awt.Point centerOf(java.awt.Rectangle r)
public static java.awt.Rectangle getBoundsOf(java.awt.Point[] points)
public static boolean isInSnapRange(java.awt.Point mousePoint, java.awt.Point posPoint, int snapRange)
public static java.awt.Point validatePoint(java.awt.Point p)
public static java.awt.Rectangle validateRect(java.awt.Rectangle r)
public static java.awt.Point checkInRange(java.awt.Point point, java.awt.Dimension dim)
java.lang.IllegalArgumentException
- if this is not the casepublic static void setToSameHeight(javax.swing.JComponent... components)
public static void setToSameWidth(javax.swing.JComponent... components)
public static void setToSameSize(javax.swing.JComponent... components)
public static java.awt.Dimension maxOf(java.awt.Dimension d1, java.awt.Dimension d2)
public static void exitLater(int exitCode)
public static void checkIsEventDispatchThread()
public static void popWindowToFrontOf(javax.swing.JComponent comp)
public static javax.swing.border.Border marginizeBorder(javax.swing.border.Border border, java.awt.Insets ins)
public static void setFieldColor(java.awt.Component comp, java.awt.Color bg)
getLabelColorFor(Color)
public static java.awt.Color getLabelColorFor(java.awt.Color bg)
public static java.awt.Window getRootContainerOf(javax.swing.JComponent comp)
public static int getStringWidth(javax.swing.JComponent comp, java.lang.String s)
public static int getStringWidth(javax.swing.JComponent comp, int numChars)
public static int getStringWidth(java.awt.Font font, java.lang.String str)
public static void locateWindow(ToolWindow win, java.awt.Component comp, WindowAlignment alignment)
public static void shiftWindow(java.awt.Window win, int deltaX, int deltaY)
public static void locateWindow(java.awt.Window win, int newX, int newY)
public static java.awt.Dimension getMaximumScreenDimension()
Copyright © 2014 EsprIT-Systems. All Rights Reserved.