public class UILib
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static void |
addGlue(javax.swing.JComponent b,
boolean horiz)
Add a glue, or variable spacing, to a UI component
|
static void |
addGlue(javax.swing.JComponent b,
int layout)
Add a glue, or variable spacing, to a UI component
|
static void |
addStrut(javax.swing.JComponent b,
boolean horiz,
int size)
Add a strut, or rigid spacing, to a UI component
|
static void |
addStrut(javax.swing.JComponent b,
int layout,
int size)
Add a strut, or rigid spacing, to a UI component
|
static int |
getAxis(javax.swing.JComponent c,
int layout)
Resolve the axis type of a component, given a layout orientation
|
static javax.swing.Box |
getBox(java.awt.Component[] c,
boolean horiz,
int margin,
int spacing)
Convenience method for creating a Box user interface widget container.
|
static javax.swing.Box |
getBox(java.awt.Component[] c,
boolean horiz,
int margin1,
int margin2,
int spacing)
Convenience method for creating a Box user interface widget container.
|
static boolean |
isButtonPressed(java.awt.event.InputEvent e,
int button)
Indicates if a given mouse button is being pressed.
|
static void |
setColor(java.awt.Component c,
java.awt.Color back,
java.awt.Color fore)
Sets the foreground and background color for a component and all
components contained within it.
|
static void |
setFont(java.awt.Component c,
java.awt.Font font)
Sets the font for a component and all
components contained within it.
|
static void |
setPlatformLookAndFeel()
Set the look and feel of Java Swing user interface components to match
that of the platform (Windows, Mac, Linux, etc) on which it is
currently running.
|
public static boolean isButtonPressed(java.awt.event.InputEvent e, int button)
e
- the InputEvent to checkbutton
- the mouse button to look forControl
public static final void setPlatformLookAndFeel()
public static javax.swing.Box getBox(java.awt.Component[] c, boolean horiz, int margin, int spacing)
c
- an array of components to include in the boxhoriz
- indicated is the box should be horizontal (true) or
vertical (false)margin
- the margins, in pixels, to use on the sides of the boxspacing
- the minimum spacing, in pixels, to use between
componentsBox
public static javax.swing.Box getBox(java.awt.Component[] c, boolean horiz, int margin1, int margin2, int spacing)
c
- an array of components to include in the boxhoriz
- indicated is the box should be horizontal (true) or
vertical (false)margin1
- the margin, in pixels, for the left or top sidemargin2
- the margin, in pixels, for the right or bottom sidespacing
- the minimum spacing, in pixels, to use between
componentsBox
public static void addStrut(javax.swing.JComponent b, boolean horiz, int size)
b
- the component to add the strut to, should be either a Box or a
Container using a BoxLayout.horiz
- indicates if the strust should horizontal (true) or vertical
(false)size
- the length, in pixels, of the strutpublic static void addGlue(javax.swing.JComponent b, boolean horiz)
b
- the component to add the glue to, should be either a Box or a
Container using a BoxLayout.horiz
- indicates if the glue should horizontal (true) or vertical
(false)public static void addStrut(javax.swing.JComponent b, int layout, int size)
b
- the component to add the strut to, should be either a Box or a
Container using a BoxLayout.layout
- the desired layout orientation of the strut. One of
BoxLayout.X_AXIS
,
BoxLayout.Y_AXIS
,
BoxLayout.LINE_AXIS
, or
BoxLayout.PAGE_AXIS
.size
- the length, in pixels, of the strutpublic static void addGlue(javax.swing.JComponent b, int layout)
b
- the component to add the glue to, should be either a Box or a
Container using a BoxLayout.layout
- the desired layout orientation of the glue. One of
BoxLayout.X_AXIS
,
BoxLayout.Y_AXIS
,
BoxLayout.LINE_AXIS
, or
BoxLayout.PAGE_AXIS
.public static int getAxis(javax.swing.JComponent c, int layout)
c
- a Swing Component, should be either a Box or a Container
using a BoxLayout.layout
- the layout orientation of the component. One of
BoxLayout.X_AXIS
,
BoxLayout.Y_AXIS
,
BoxLayout.LINE_AXIS
, or
BoxLayout.PAGE_AXIS
.BoxLayout.X_AXIS
, or
BoxLayout.Y_AXIS
,public static void setColor(java.awt.Component c, java.awt.Color back, java.awt.Color fore)
c
- the parent component of the component subtree to setback
- the background color to setfore
- the foreground color to setpublic static void setFont(java.awt.Component c, java.awt.Font font)
c
- the parent component of the component subtree to setfont
- the font to setCopyright ? 2013 Regents of the University of California