/**
 *
 */
public class ModifyDialog extends java.awt.Dialog {

  /** Initializes the Form */
  public ModifyDialog(java.awt.Frame parent, boolean modal, String What, String Value) {
    super (parent, modal);
    initComponents ();
    LabelWhat.setText(What);
    ValueTextField.setText(Value);
    _value = null;
    pack ();
  }

  /** This method is called from within the init() method to
   * initialize the form.
   * WARNING: Do NOT modify this code. The content of this method is
   * always regenerated by the FormEditor.
   */
  private void initComponents () {//GEN-BEGIN:initComponents
    setBackground (new java.awt.Color (192, 192, 192));
    setTitle ("Modify");
    addWindowListener (new java.awt.event.WindowAdapter () {
        public void windowClosing (java.awt.event.WindowEvent evt) {
          closeDialog (evt);
        }
      }
    );
    setLayout (new java.awt.BorderLayout ());

    LabelWhat = new javax.swing.JLabel ();
    add (LabelWhat, "West");

    ValueTextField = new javax.swing.JTextField ();
    ValueTextField.setPreferredSize (new java.awt.Dimension(50, 21));
    ValueTextField.setMaximumSize (new java.awt.Dimension(50, 21));
    ValueTextField.setMinimumSize (new java.awt.Dimension(50, 21));
    ValueTextField.setHorizontalAlignment (javax.swing.SwingConstants.RIGHT);
    add (ValueTextField, "East");

    TitleLabel = new javax.swing.JLabel ();
    TitleLabel.setText ("Enter a new value :");
    add (TitleLabel, "North");

    jPanel1 = new javax.swing.JPanel ();
    jPanel1.setLayout (new java.awt.BorderLayout ());

      CancelButton = new javax.swing.JButton ();
      CancelButton.setText ("Cancel");
      CancelButton.setLabel ("Cancel");
      CancelButton.addActionListener (new java.awt.event.ActionListener () {
          public void actionPerformed (java.awt.event.ActionEvent evt) {
            CancelButtonActionPerformed (evt);
          }
        }
      );
      jPanel1.add (CancelButton, "West");

      OkButton = new javax.swing.JButton ();
      OkButton.setText ("Ok");
      OkButton.setLabel ("Ok");
      OkButton.addActionListener (new java.awt.event.ActionListener () {
          public void actionPerformed (java.awt.event.ActionEvent evt) {
            OkButtonActionPerformed (evt);
          }
        }
      );
      jPanel1.add (OkButton, "East");

    add (jPanel1, "South");

  }//GEN-END:initComponents

  private void OkButtonActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_OkButtonActionPerformed
    _value = ValueTextField.getText();
    setVisible (false);
    dispose ();
  }//GEN-LAST:event_OkButtonActionPerformed

  private void CancelButtonActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CancelButtonActionPerformed
    _value = "Canceled";
    setVisible (false);
    dispose ();
  }//GEN-LAST:event_CancelButtonActionPerformed


  /** Closes the dialog */
  private void closeDialog(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_closeDialog
    setVisible (false);
    dispose ();
  }//GEN-LAST:event_closeDialog


// Variables declaration - do not modify//GEN-BEGIN:variables
  private javax.swing.JLabel LabelWhat;
  private javax.swing.JTextField ValueTextField;
  private javax.swing.JLabel TitleLabel;
  private javax.swing.JPanel jPanel1;
  private javax.swing.JButton CancelButton;
  private javax.swing.JButton OkButton;
// End of variables declaration//GEN-END:variables

  public String GetValue() {
    while(_value == null);
    return _value;
  }

  String _value;

  public static void main(java.lang.String[] args) {
    new ModifyDialog (new java.awt.Frame (), false, "PC =", "000").show ();
  }

}