Package weka.gui
Class ComponentHelper
java.lang.Object
weka.gui.ComponentHelper
A helper class for some common tasks with Dialogs, Icons, etc.
- Version:
- $Revision: 15571 $
- Author:
- FracPete (fracpete at waikato dot ac dot nz)
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Image
returns the Image for a given filename, NULL if not successfulstatic Image
returns the Image for a given directory and filename, NULL if not successfulstatic ImageIcon
getImageIcon
(String filename) returns the ImageIcon for a given filename, NULL if not successfulstatic ImageIcon
getImageIcon
(String dir, String filename) returns the ImageIcon for a given filename and directory, NULL if not successfulstatic void
showInformationBox
(Component parent, String title, String msg, int messageType) displays a message box with the given title, message, buttons and icon ant the dimension.static String
showInputBox
(Component parent, String title, String msg, Object initialValue) pops up an input dialogstatic 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.
-
Field Details
-
IMAGES
the default directories for images
-
-
Constructor Details
-
ComponentHelper
public ComponentHelper()
-
-
Method Details
-
getImageIcon
returns the ImageIcon for a given filename and directory, NULL if not successful- Parameters:
dir
- the directory to look in for the filefilename
- the file to retrieve- Returns:
- the imageicon if found, otherwise null
-
getImageIcon
returns the ImageIcon for a given filename, NULL if not successful- Parameters:
filename
- the file to retrieve- Returns:
- the imageicon if found, otherwise null
-
getImage
returns the Image for a given directory and filename, NULL if not successful- Parameters:
dir
- the directory to look in for the filefilename
- the file to retrieve- Returns:
- the image if found, otherwise null
-
getImage
returns the Image for a given filename, NULL if not successful- Parameters:
filename
- the file to retrieve- Returns:
- the image if found, otherwise null
-
showMessageBox
public 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. This method uses JOptionPane.showConfirmDialog(). it returns the pressed button.- Parameters:
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 inJOptionPane
(the icon is determined on this basis)- Returns:
- the button that was pressed
- See Also:
-
showInformationBox
displays a message box with the given title, message, buttons and icon ant the dimension. This method uses JOptionPane.showMessageDialog().- Parameters:
parent
- the parent componenttitle
- the title of the message boxmsg
- the text to displaymessageType
- the type of message like defined inJOptionPane
(the icon is determined on this basis)- See Also:
-
showInputBox
pops up an input dialog- Parameters:
parent
- the parent of this dialog, can benull
title
- the title to display, can benull
msg
- the message to displayinitialValue
- the initial value to display as input- Returns:
- the entered value, or if cancelled
null
-