org.psychomad.psycholib.ui
Class EasyDialog

java.lang.Object
  extended by org.psychomad.psycholib.ui.EasyDialog

public class EasyDialog
extends java.lang.Object

This class contains a lot of functionalities for displaying dialog boxes. Don't forget to give a parent component so the dialog can be center relative to your main window. Use the setParentComponent() method. Don't forget to give the default directory for the filechooser so he opens in the good directory. Use the setFileChooserDefaultDirectory() method. You will be able to change this dir temporary by using the same method passing a second argument.


Field Summary
static int OPEN_DIALOG
          This value must be used if you want to open a Load dialog box.
static int SAVE_DIALOG
          This value must be used if you want to open a Save dialog box.
 
Constructor Summary
EasyDialog()
           
 
Method Summary
static java.lang.String getSelectedFile()
          This method allow to get the string corresponding to the selected file int the fileChooser.
static void setFileChooserDefaultDirectory(java.lang.String defaultDirectory)
          This method allow to set the default directory for the filechooser.
static void setParentComponent(java.awt.Component parentComponent)
          This method allow to init the parent component of the dialogs.
static void showErrorMsg(java.lang.Object msg)
          Show an error message.
static int showFileChooser(int typeOfDialog)
          Show a file chooser.
static int showFileChooser(int typeOfDialog, java.lang.String tmpDir)
          Show a file chooser.
static void showInfoMsg(java.lang.Object msg)
          Show an information message.
static int showInternalQuestionMsg(java.awt.Component pC, java.lang.Object msg)
          TODO Show a question message.
static int showQuestionMsg(java.lang.Object msg)
          Show a question message.
static java.lang.String[] tokenize(java.lang.String input)
          Take the given string and chop it up into a series of strings on whitespace boundries.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OPEN_DIALOG

public static final int OPEN_DIALOG
This value must be used if you want to open a Load dialog box.

See Also:
Constant Field Values

SAVE_DIALOG

public static final int SAVE_DIALOG
This value must be used if you want to open a Save dialog box.

See Also:
Constant Field Values
Constructor Detail

EasyDialog

public EasyDialog()
Method Detail

setParentComponent

public static void setParentComponent(java.awt.Component parentComponent)
This method allow to init the parent component of the dialogs.

Parameters:
parentComponent - the parent component for the dialogs.

setFileChooserDefaultDirectory

public static void setFileChooserDefaultDirectory(java.lang.String defaultDirectory)
This method allow to set the default directory for the filechooser.

Parameters:
defaultDirectory - the default directory for the file chooser.

showErrorMsg

public static void showErrorMsg(java.lang.Object msg)
Show an error message.

Parameters:
msg - the message to display.

showInfoMsg

public static void showInfoMsg(java.lang.Object msg)
Show an information message.

Parameters:
msg - the message to display.

showQuestionMsg

public static int showQuestionMsg(java.lang.Object msg)
Show a question message.

Parameters:
msg - the message to display.
Returns:
an int indicating the choice of the user.

showFileChooser

public static int showFileChooser(int typeOfDialog,
                                  java.lang.String tmpDir)
Show a file chooser.

Parameters:
typeOfDialog - one of the following : OPEN_DIALOG or SAVE_DIALOG.
tmpDir - the directory where the filechooser point. If this param is null then this is equivalent to call the showFileChooser(int) method.
Returns:
an int indicating the choice of the user.

showFileChooser

public static int showFileChooser(int typeOfDialog)
Show a file chooser.

Parameters:
typeOfDialog - one of the following : OPEN_DIALOG or SAVE_DIALOG.
Returns:
an int indicating the choice of the user.

getSelectedFile

public static java.lang.String getSelectedFile()
This method allow to get the string corresponding to the selected file int the fileChooser.

Returns:
the path of the selected file

showInternalQuestionMsg

public static int showInternalQuestionMsg(java.awt.Component pC,
                                          java.lang.Object msg)
TODO Show a question message.

Parameters:
msg - the message to display.
Returns:
an int indicating the choice of the user.

tokenize

public static java.lang.String[] tokenize(java.lang.String input)
Take the given string and chop it up into a series of strings on whitespace boundries. This is useful for trying to get an array of strings out of the resource file.



Copyright 2006 null. All Rights Reserved.