org.jurvis.swing
Class JvPanelDialog

java.lang.Object
  extended by org.jurvis.swing.JvPanelDialog

public class JvPanelDialog
extends Object

A class that displays a panel within a JDialog. The pattern this class implements follows the panel-dialog pattern set by JColorChooser and JOptionPane.

Author:
Neil W. Weber

Nested Class Summary
 class JvPanelDialog.CancelAction
          The action mapped to the CANCEL button.
 class JvPanelDialog.OkAction
          The action mapped to the OK button.
 
Field Summary
static int APPROVE_OPTION
          Return value if approve (yes, ok) is chosen.
static int CANCEL_OPTION
          Return value if cancel is chosen.
protected  JDialog dialog
           
static int ERROR_OPTION
          Return value if an error occured.
protected  int returnValue
           
 
Constructor Summary
JvPanelDialog()
          Construct a new JvPanelDialog.
 
Method Summary
 void approveSelection()
          Approve the user's selection and close the dialog.
 Action createCancelAction()
           
 Action createOkAction()
           
 void rejectSelection()
          Reject the user's selection and close the dialog.
 int showDialog(Component parent, JComponent panel, String title)
          Show a modal dialog with the specified panel as the dialog's contents.
 int showDialog(Component parent, JComponent panel, String title, JButton defaultButton)
          Show a modal dialog with the specified panel as the dialog's contents.
static int showOkCancelDialog(Component parent, JComponent panel, String title)
          Show a modal dialog with the specified panel as the dialog's contents and OK and Cancel buttons along the bottom.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CANCEL_OPTION

public static final int CANCEL_OPTION
Return value if cancel is chosen.

See Also:
Constant Field Values

APPROVE_OPTION

public static final int APPROVE_OPTION
Return value if approve (yes, ok) is chosen.

See Also:
Constant Field Values

ERROR_OPTION

public static final int ERROR_OPTION
Return value if an error occured.

See Also:
Constant Field Values

returnValue

protected int returnValue

dialog

protected JDialog dialog
Constructor Detail

JvPanelDialog

public JvPanelDialog()
Construct a new JvPanelDialog.

Method Detail

showDialog

public int showDialog(Component parent,
                      JComponent panel,
                      String title)
Show a modal dialog with the specified panel as the dialog's contents.

Parameters:
parent - the parent Component for the dialog
panel - the panel to be displayed
title - the String containing the dialog's title
Returns:
CANCEL_OPTION, ERROR_OPTION, APPROVE_OPTION

showDialog

public int showDialog(Component parent,
                      JComponent panel,
                      String title,
                      JButton defaultButton)
Show a modal dialog with the specified panel as the dialog's contents.

Parameters:
parent - the parent Component for the dialog
panel - the panel to be displayed
title - the String containing the dialog's title
defaultButton - the JButton which is to be the default button
Returns:
CANCEL_OPTION, ERROR_OPTION, APPROVE_OPTION

showOkCancelDialog

public static int showOkCancelDialog(Component parent,
                                     JComponent panel,
                                     String title)
Show a modal dialog with the specified panel as the dialog's contents and OK and Cancel buttons along the bottom.

Parameters:
parent - the parent Component for the dialog
panel - the panel to be displayed
title - the String containing the dialog's title
Returns:
CANCEL_OPTION, ERROR_OPTION, APPROVE_OPTION

approveSelection

public void approveSelection()
Approve the user's selection and close the dialog. Method called when the user clicks the OK button.


rejectSelection

public void rejectSelection()
Reject the user's selection and close the dialog. Method called when the user clicks the CANCEL button.


createOkAction

public Action createOkAction()

createCancelAction

public Action createCancelAction()


Copyright © 1999-2004 Neil W. Weber. All Rights Reserved.