public class SGUI
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
AUTO_ADJUST
This property can be set on components to be automatically adjusted to equal sizes.
|
Constructor and Description |
---|
SGUI() |
Modifier and Type | Method and Description |
---|---|
static void |
adjustComponentSizes(java.awt.Container parent)
Adjust all marked components to equal sizes according to their
miminum, maximum, and preferred sizes.
|
static void |
adjustComponentSizes(javax.swing.JComponent[] components)
Adjust components to equal sizes according to their
miminum, maximum, and preferred sizes.
|
static java.awt.Point |
calculateMiddlePosition(java.awt.Window win)
Calculate the middle position of a window relativ to
|
static java.awt.Point |
calculateMiddlePosition(java.awt.Window outer,
java.awt.Window win)
Calculate the middle position of a window relativ to
|
static java.lang.String |
colorToHTML(java.awt.Color color)
Convert a color to an html representation.
|
static javax.swing.Action |
createAction(java.lang.String name,
javax.swing.Icon icon,
java.awt.event.ActionListener listener)
Create an action.
|
static boolean |
createDialog(java.lang.String title,
javax.swing.JComponent content,
javax.swing.JComponent comp)
Create a dialog with a specific content panel.
|
static boolean |
createDialog(java.lang.String title,
javax.swing.JComponent content,
javax.swing.JComponent comp,
boolean info)
Create a dialog with a specific content panel.
|
static javax.swing.JMenuBar |
createMenuBar(javax.swing.Action[] actions)
Create a menu bar, given a list of actions.
|
static javax.swing.JTable |
createReadOnlyTable()
Create a table that displays its contents using nto editable text fields.
|
static javax.swing.JToolBar |
createToolBar(java.lang.String name,
javax.swing.Action[] actions)
Create a tool bar, given a list of actions.
|
static java.lang.String |
fontToHTML(java.awt.Font font)
Convert a font to an html representation.
|
static double |
getProportionalDividerLocation(javax.swing.JSplitPane pane)
Get the proportional split location.
|
static java.awt.Window |
getWindowParent(java.awt.Component comp)
Get the window parent if any.
|
static void |
invokeLater(java.lang.Runnable runnable)
Use SwingUtilities to put the given runnable in the AWT Event queue.
|
static java.lang.Object |
makeIcon(java.lang.Class baseclass,
java.lang.String imgloc)
Utility method that creates a UIDefaults.LazyValue that creates
an ImageIcon for the specified
gifFile filename. |
static void |
renderObject(java.awt.Graphics g,
java.awt.Component comp,
double cellw,
double cellh,
int x,
int y,
int gridwidth)
Render an object on a grid.
|
static java.awt.image.BufferedImage |
scaleImage(java.awt.Image src,
int w,
int h,
int type)
Scale an image.
|
static void |
showError(java.awt.Component parent,
java.lang.String errortitle,
java.lang.String errormessage,
java.lang.Exception exception)
Display an error dialog.
|
static void |
showMessageDialog(java.awt.Component parent,
java.lang.Object message,
java.lang.String title,
int msgtype)
Show an non-model message dialog.
|
static java.awt.Color |
stringToColor(java.lang.String str)
Color conversion method for "web-style" color definitions.
|
public static final java.lang.String AUTO_ADJUST
public static javax.swing.JMenuBar createMenuBar(javax.swing.Action[] actions)
actions
- The actions (null is mapped to separator).public static javax.swing.JToolBar createToolBar(java.lang.String name, javax.swing.Action[] actions)
name
- The name of the toolbar.actions
- The actions (null is mapped to separator).public static javax.swing.Action createAction(java.lang.String name, javax.swing.Icon icon, java.awt.event.ActionListener listener)
name
- The name.icon
- The path to the icon.listener
- The action listener.public static boolean createDialog(java.lang.String title, javax.swing.JComponent content, javax.swing.JComponent comp)
public static boolean createDialog(java.lang.String title, javax.swing.JComponent content, javax.swing.JComponent comp, boolean info)
public static java.lang.Object makeIcon(java.lang.Class baseclass, java.lang.String imgloc)
gifFile
filename.public static void renderObject(java.awt.Graphics g, java.awt.Component comp, double cellw, double cellh, int x, int y, int gridwidth)
g
- The graphics object.comp
- The object to render.cellw
- The cell width.cellh
- The cell height.public static java.awt.Point calculateMiddlePosition(java.awt.Window win)
public static java.awt.Point calculateMiddlePosition(java.awt.Window outer, java.awt.Window win)
public static java.awt.Window getWindowParent(java.awt.Component comp)
comp
- The component.public static void showMessageDialog(java.awt.Component parent, java.lang.Object message, java.lang.String title, int msgtype)
public static void showError(java.awt.Component parent, java.lang.String errortitle, java.lang.String errormessage, java.lang.Exception exception)
errortitle
- The title to use for an error dialog (required).errormessage
- An optional error message displayed before the exception.exception
- The exception (if any).public static void adjustComponentSizes(javax.swing.JComponent[] components)
public static void adjustComponentSizes(java.awt.Container parent)
AUTO_ADJUST
property
to an arbitrary value.public static javax.swing.JTable createReadOnlyTable()
public static double getProportionalDividerLocation(javax.swing.JSplitPane pane)
public static java.awt.Color stringToColor(java.lang.String str)
public static java.lang.String colorToHTML(java.awt.Color color)
color
- The color.public static java.lang.String fontToHTML(java.awt.Font font)
font
- The font.public static java.awt.image.BufferedImage scaleImage(java.awt.Image src, int w, int h, int type)
scr
- The src image.w
- The width.h
- The height.type
- The type (Image.SCALE_XYZ).public static void invokeLater(java.lang.Runnable runnable)
runnable
-