
public final class GUIUtilities extends Object
| Modifier | Constructor and Description |
|---|---|
private |
GUIUtilities() |
| Modifier and Type | Method and Description |
|---|---|
static void |
alertMessage(String title,
String content)
Displays a warning message.
|
static void |
disableDoubleBuffering(Component c)
Turns the double buffering off.
|
static void |
displayInCenterOfScreen(Component f)
Displays a Component in center of the screen.
|
static void |
enableDoubleBuffering(Component c)
Turns the double buffering on.
|
static void |
errorMessage(Throwable e)
Displays on screen an error containing an Exception.
|
static void |
errorMessage(Throwable e,
boolean stackTrace)
Displays on screen an error screen describing an Exception.
|
static GraphicsDevice[] |
getGraphicDevices() |
static ImageIcon |
loadScaledImage(String path,
int w,
int h)
Loads a resized instance of an ImageIcon.
|
static void |
packAndDisplayInCenterOfScreen(Window f)
Packs a Window and display it in center of the screen.
|
static void |
saveComponentAsImage(String path,
Component target,
String format)
Given a component, saves it on disk as image.
|
static void |
setDefaultIcon(JFrame window,
String imagepath)
Sets the icon for a window.
|
static void |
warningMessage(String title,
String content)
Displays a warning message.
|
public static void alertMessage(String title, String content)
title - The title of the windowcontent - The text to display insidepublic static void disableDoubleBuffering(Component c)
c - the component whose double buffering should be disabledpublic static void displayInCenterOfScreen(Component f)
f - the component to displaypublic static void enableDoubleBuffering(Component c)
c - the component whose double buffering should be enabledpublic static void errorMessage(Throwable e)
e - the Throwable that generates the error eventpublic static void errorMessage(Throwable e, boolean stackTrace)
e - the Throwable that generates the error eventstackTrace - choose wether to print or not the complete stacktracepublic static ImageIcon loadScaledImage(String path, int w, int h)
path - the path where to load the icon. This method uses the System
resource loader, and it's thus able to access resources
located in the whole classpath, jars includedw - widthh - heightpublic static void packAndDisplayInCenterOfScreen(Window f)
f - the window to pack and displaypublic static void saveComponentAsImage(String path, Component target, String format) throws IOException
path - the file to savetarget - the component to save as imageformat - a string describing the format. See
http://docs.oracle.com/javase
/7/docs/api/javax/imageio/package-
summary.html#package_description for a list of available
formats.IOException - in case of I/O Errorspublic static void setDefaultIcon(JFrame window, String imagepath)
window - the target windowimagepath - the image which should be iconpublic static void warningMessage(String title, String content)
title - the title of the windowcontent - the content of the warningpublic static GraphicsDevice[] getGraphicDevices()
GraphicsDevice