public class ComponentUtil extends java.lang.Object
Constructor and Description |
---|
ComponentUtil() |
Modifier and Type | Method and Description |
---|---|
static javax.swing.tree.TreePath |
buildTreePath(javax.swing.tree.TreeNode node) |
static void |
center(java.awt.Component comp)
Center specified component relative to its parent
|
static void |
center(java.awt.Component dst,
java.awt.Component src) |
static void |
center(java.awt.Component dst,
IcyFrame src) |
static void |
center(IcyFrame f)
Deprecated.
|
static void |
center(IcyFrame dst,
java.awt.Component src) |
static void |
center(IcyFrame dst,
IcyFrame src) |
static void |
center(javax.swing.JInternalFrame frame)
Center specified JInternalFrame
|
static void |
center(java.awt.Window window)
Center specified windows relative to its parent
|
static void |
centerOn(java.awt.Component comp,
java.awt.Point position)
Center specified component relative to its parent
|
static void |
centerOn(javax.swing.JInternalFrame f,
java.awt.Point position)
Center the JInternalFrame on specified point
|
static void |
centerOn(java.awt.Window window,
java.awt.Point position)
Center the Window on specified point
|
static java.awt.Point |
convertPoint(java.awt.Component src,
java.awt.Point p,
java.awt.Component dst) |
static java.awt.Point |
convertPointFromScreen(java.awt.Point p,
java.awt.Component c) |
static java.awt.Point |
convertPointToScreen(java.awt.Point p,
java.awt.Component c) |
static void |
decreaseFontSize(java.awt.Component c,
int value) |
static void |
expandAllTree(javax.swing.JTree tree) |
static boolean |
fixPosition(java.awt.Component component)
Fix the given bounds of specified component so it does not go completely off screen.
|
static boolean |
fixPosition(java.awt.Component component,
java.awt.Rectangle wantedBounds)
Fix the given bounds of specified component so it does not go completely off screen.
|
static java.awt.Point |
fixPosition(java.awt.Rectangle wantedBounds,
java.awt.Rectangle screenBounds)
Returns the new location of wanted bounds so it does not go outside the specified screen bounds.
|
static java.awt.geom.Point2D.Double |
getCenter(java.awt.Component c)
Returns the center position of the specified component.
|
static int |
getComponentIndex(java.awt.Component c) |
static javax.swing.event.HyperlinkListener |
getDefaultHyperlinkListener() |
static java.awt.GraphicsDevice |
getScreen(java.awt.Component c)
Returns the main screen device where the specified component is currently displayed.
|
static java.util.List<java.awt.GraphicsDevice> |
getScreens(java.awt.Component c)
Returns all screen device where the specified component is currently displayed.
|
static void |
increaseFontSize(java.awt.Component c,
int value) |
static boolean |
isInside(java.awt.Component c,
java.awt.Rectangle r) |
static boolean |
isMaximized(java.awt.Frame f) |
static boolean |
isMinimized(java.awt.Frame f) |
static boolean |
isOutside(java.awt.Component c,
java.awt.Rectangle r) |
static void |
removeFixedSize(java.awt.Component c) |
static void |
setFixedHeight(java.awt.Component c,
int h) |
static void |
setFixedHeight(IcyFrame frm,
int h) |
static void |
setFixedSize(java.awt.Component c,
java.awt.Dimension d) |
static void |
setFixedSize(IcyFrame frm,
java.awt.Dimension d) |
static void |
setFixedWidth(java.awt.Component c,
int w) |
static void |
setFixedWidth(IcyFrame frm,
int w) |
static void |
setFontBold(java.awt.Component c) |
static void |
setFontSize(java.awt.Component c,
int fontSize) |
static void |
setFontStyle(java.awt.Component c,
int fontStyle) |
static void |
setJTextPaneFont(javax.swing.JTextPane tp,
java.awt.Font font,
java.awt.Color c) |
static void |
setMaximized(java.awt.Frame f,
boolean b) |
static void |
setMinimized(java.awt.Frame f,
boolean b) |
static void |
setPreferredHeight(java.awt.Component c,
int h) |
static void |
setPreferredHeight(IcyFrame frm,
int h) |
static void |
setPreferredWidth(java.awt.Component c,
int w) |
static void |
setPreferredWidth(IcyFrame frm,
int w) |
static void |
setTickMarkers(javax.swing.JSlider slider) |
static void |
split(javax.swing.JMenu menu,
int maxItemsPerMenu)
Breaks the list of items in the specified menu, by creating sub-menus containing the
specified number of items, and a "More..." menu to access subsequent items.
|
public ComponentUtil()
public static void setPreferredWidth(java.awt.Component c, int w)
public static void setPreferredHeight(java.awt.Component c, int h)
public static void setFixedSize(java.awt.Component c, java.awt.Dimension d)
public static void setFixedWidth(java.awt.Component c, int w)
public static void setFixedHeight(java.awt.Component c, int h)
public static void setPreferredWidth(IcyFrame frm, int w)
public static void setPreferredHeight(IcyFrame frm, int h)
public static void setFixedSize(IcyFrame frm, java.awt.Dimension d)
public static void setFixedWidth(IcyFrame frm, int w)
public static void setFixedHeight(IcyFrame frm, int h)
public static void removeFixedSize(java.awt.Component c)
public static void center(java.awt.Component comp)
public static void center(java.awt.Window window)
public static void center(javax.swing.JInternalFrame frame)
public static void centerOn(java.awt.Window window, java.awt.Point position)
public static void centerOn(javax.swing.JInternalFrame f, java.awt.Point position)
public static void centerOn(java.awt.Component comp, java.awt.Point position)
public static void center(java.awt.Component dst, java.awt.Component src)
public static java.awt.geom.Point2D.Double getCenter(java.awt.Component c)
public static java.util.List<java.awt.GraphicsDevice> getScreens(java.awt.Component c)
public static java.awt.GraphicsDevice getScreen(java.awt.Component c)
null
if component is not located on any screen device.public static java.awt.Point fixPosition(java.awt.Rectangle wantedBounds, java.awt.Rectangle screenBounds)
null
if the wanted bounds doesn't need position adjustment.public static boolean fixPosition(java.awt.Component component, java.awt.Rectangle wantedBounds)
true
if the bounds position has be adjusted.public static boolean fixPosition(java.awt.Component component)
true
if component position has be adjusted.public static int getComponentIndex(java.awt.Component c)
public static java.awt.Point convertPoint(java.awt.Component src, java.awt.Point p, java.awt.Component dst)
public static java.awt.Point convertPointFromScreen(java.awt.Point p, java.awt.Component c)
public static java.awt.Point convertPointToScreen(java.awt.Point p, java.awt.Component c)
public static boolean isOutside(java.awt.Component c, java.awt.Rectangle r)
public static boolean isInside(java.awt.Component c, java.awt.Rectangle r)
public static void increaseFontSize(java.awt.Component c, int value)
public static void decreaseFontSize(java.awt.Component c, int value)
public static void setFontSize(java.awt.Component c, int fontSize)
public static void setFontStyle(java.awt.Component c, int fontStyle)
public static void setFontBold(java.awt.Component c)
public static void setJTextPaneFont(javax.swing.JTextPane tp, java.awt.Font font, java.awt.Color c)
public static void setTickMarkers(javax.swing.JSlider slider)
public static void split(javax.swing.JMenu menu, int maxItemsPerMenu)
menu
- the menu to break into smaller sub-menusmaxItemsPerMenu
- the maximum number of items to display in each sub-menupublic static javax.swing.tree.TreePath buildTreePath(javax.swing.tree.TreeNode node)
public static void expandAllTree(javax.swing.JTree tree)
public static javax.swing.event.HyperlinkListener getDefaultHyperlinkListener()
public static boolean isMaximized(java.awt.Frame f)
public static void setMaximized(java.awt.Frame f, boolean b)
public static boolean isMinimized(java.awt.Frame f)
public static void setMinimized(java.awt.Frame f, boolean b)