/*
 * ErrorDialog.java
 *
 * Created 10/28/06
 * Last modified 10/28/06
 */

package lab14;

/**
 *
 * @author J.K. Daugherty
 */
public class ErrorDialog extends javax.swing.JDialog {
    
    /** Creates new form ErrorDialog */
    public ErrorDialog(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    private void initComponents() {//GEN-BEGIN:initComponents
        bottomPanel = new javax.swing.JPanel();
        btnOK = new javax.swing.JButton();
        txtMessage = new javax.swing.JTextArea();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Input Error Dialog");
        btnOK.setText("OK");
        btnOK.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnOKActionPerformed(evt);
            }
        });

        bottomPanel.add(btnOK);

        getContentPane().add(bottomPanel, java.awt.BorderLayout.SOUTH);

        getContentPane().add(txtMessage, java.awt.BorderLayout.CENTER);

        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        setBounds((screenSize.width-250)/2, (screenSize.height-200)/2, 250, 200);
    }//GEN-END:initComponents

    private void btnOKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOKActionPerformed
        // TODO add your handling code here:
        dispose();
    }//GEN-LAST:event_btnOKActionPerformed
    
    public void setText (String message) {
        txtMessage.setText (message);
    }
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new ErrorDialog(new javax.swing.JFrame(), true).setVisible(true);
            }
        });
    }
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel bottomPanel;
    private javax.swing.JButton btnOK;
    private javax.swing.JTextArea txtMessage;
    // End of variables declaration//GEN-END:variables
    
}
