public class ComponentHelper extends Object
Modifier and Type | Field and Description |
---|---|
static String[] |
IMAGES
the default directories for images
|
Constructor and Description |
---|
ComponentHelper() |
Modifier and Type | Method and Description |
---|---|
static Image |
getImage(String filename)
returns the Image for a given filename, NULL if not successful
|
static Image |
getImage(String dir,
String filename)
returns the Image for a given directory and filename, NULL if not successful
|
static ImageIcon |
getImageIcon(String filename)
returns the ImageIcon for a given filename, NULL if not successful
|
static ImageIcon |
getImageIcon(String dir,
String filename)
returns the ImageIcon for a given filename and directory, NULL if not successful
|
static String |
showInputBox(Component parent,
String title,
String msg,
Object initialValue)
pops up an input dialog
|
static int |
showMessageBox(Component parent,
String title,
String msg,
int buttons,
int messageType)
displays a message box with the given title, message, buttons and icon
ant the dimension.
|
public static final String[] IMAGES
public static ImageIcon getImageIcon(String dir, String filename)
dir
- the directory to look in for the filefilename
- the file to retrievepublic static ImageIcon getImageIcon(String filename)
filename
- the file to retrievepublic static Image getImage(String dir, String filename)
dir
- the directory to look in for the filefilename
- the file to retrievepublic static Image getImage(String filename)
filename
- the file to retrievepublic static int showMessageBox(Component parent, String title, String msg, int buttons, int messageType)
parent
- the parent componenttitle
- the title of the message boxmsg
- the text to displaybuttons
- the captions of the buttons to displaymessageType
- the type of message like defined in JOptionPane
(the icon is determined on this basis)JOptionPane
public static String showInputBox(Component parent, String title, String msg, Object initialValue)
parent
- the parent of this dialog, can be null
title
- the title to display, can be null
msg
- the message to displayinitialValue
- the initial value to display as inputnull
Copyright © 2012 University of Waikato, Hamilton, NZ. All Rights Reserved.