edu.rice.cs.util.swing
Class ConfirmCheckBoxDialog

java.lang.Object
  extended by edu.rice.cs.util.swing.ConfirmCheckBoxDialog

public class ConfirmCheckBoxDialog
extends Object

Simple class wrapping JOptionPane to have a checkbox underneath the message.

Version:
$Id: ConfirmCheckBoxDialog.java 5175 2010-01-20 08:46:32Z mgricken $

Field Summary
private  JCheckBox _checkBox
           
private  JDialog _dialog
           
private  JOptionPane _optionPane
           
 
Constructor Summary
ConfirmCheckBoxDialog(JFrame parent, String title, Object message)
          Instantiates a new confirm dialog with default checkbox text.
ConfirmCheckBoxDialog(JFrame parent, String title, Object message, String checkBoxText)
          Instantiates a new confirm dialog with Yes/No as the options.
ConfirmCheckBoxDialog(JFrame parent, String title, Object message, String checkBoxText, int messageType, int optionType)
          Instantiates a new confirm dialog with Yes/No as the options.
 
Method Summary
private  JCheckBox _initCheckBox(String text)
          Initializes the JCheckBox to have the given text.
 boolean getCheckBoxValue()
          Gets the selected value of the check box.
 int show()
          Shows the dialog.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_dialog

private JDialog _dialog

_optionPane

private JOptionPane _optionPane

_checkBox

private JCheckBox _checkBox
Constructor Detail

ConfirmCheckBoxDialog

public ConfirmCheckBoxDialog(JFrame parent,
                             String title,
                             Object message)
Instantiates a new confirm dialog with default checkbox text.

Parameters:
parent - the parent frame
title - the title of the dialog
message - the stuff to display in the body of the dialog. For a simple message, it should be a String; it can also be an Object[] including Strings and Components to display in the body of the dialog.

ConfirmCheckBoxDialog

public ConfirmCheckBoxDialog(JFrame parent,
                             String title,
                             Object message,
                             String checkBoxText)
Instantiates a new confirm dialog with Yes/No as the options.

Parameters:
parent - the parent frame
title - the title of the dialog
message - the stuff to display in the body of the dialog. For a simple message, it should be a String; it can also be an Object[] including Strings and Components to display in the body of the dialog.
checkBoxText - the text to display with the checkbox

ConfirmCheckBoxDialog

public ConfirmCheckBoxDialog(JFrame parent,
                             String title,
                             Object message,
                             String checkBoxText,
                             int messageType,
                             int optionType)
Instantiates a new confirm dialog with Yes/No as the options.

Parameters:
parent - The parent frame
title - The title of the dialog
message - The stuff to display in the body of the dialog. For a simple message, it should be a String; it can also be an Object[] including Strings and Components to display in the body of the dialog.
checkBoxText - The text to display with the checkbox
messageType - The JOptionPane message type
optionType - The JOptionPane option type
Method Detail

_initCheckBox

private JCheckBox _initCheckBox(String text)
Initializes the JCheckBox to have the given text.


show

public int show()
Shows the dialog.

Returns:
the JOptionPane result of showing the dialog.

getCheckBoxValue

public boolean getCheckBoxValue()
Gets the selected value of the check box. Should not be called until the dialog is shown.

Returns:
the value of the checkbox