home *** CD-ROM | disk | FTP | other *** search
- <?xml version="1.0"?>
- <Template Originator="Gary Gray" Language="JAVA" Created="09/05/2001" LastModified="09/05/2001">
-
- <TemplateConfiguration>
- <Name>Java AWT OK Dialog</Name>
- <Icon>JAVA.Project.JavaProjectIcon</Icon>
- <Category>Java</Category>
- <LanguageName>Java</LanguageName>
- <Description>A Basic Java OK Dialog</Description>
- </TemplateConfiguration>
-
- <TemplateFiles>
- <File DefaultExtension=".java" DefaultName="OKDialog">
-
- <![CDATA[
- /*
- * OKDialog.java
- *
- * created on ${Date} at ${Time}
- */
-
- public class OKDialog extends javax.swing.JDialog {
- /** A return status code - returned if Cancel button has been pressed */
- public static final int RET_CANCEL = 0;
- /** A return status code - returned if OK button has been pressed */
- public static final int RET_OK = 1;
-
- /** Creates new form OKDialog */
- public OKDialog(java.awt.Frame parent, boolean modal) {
- super(parent, modal);
- initComponents();
- }
-
- /** return the return status of this dialog - one of RET_OK or RET_CANCEL */
- public int getReturnStatus() {
- return returnStatus;
- }
-
- /** 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
- addWindowListener(new java.awt.event.WindowAdapter() {
- public void windowClosing(java.awt.event.WindowEvent evt) {
- closeDialog(evt);
- }
- }
- );
-
- buttonPanel = new javax.swing.JPanel();
- buttonPanel.setLayout(new java.awt.FlowLayout(2, 5, 5));
-
- okButton = new javax.swing.JButton();
- okButton.setText("OK");
- okButton.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- okButtonActionPerformed(evt);
- }
- }
- );
-
- buttonPanel.add(okButton);
-
- cancelButton = new javax.swing.JButton();
- cancelButton.setText("Cancel");
- cancelButton.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- cancelButtonActionPerformed(evt);
- }
- }
- );
-
- buttonPanel.add(cancelButton);
-
-
- getContentPane().add(buttonPanel, java.awt.BorderLayout.SOUTH);
-
- pack();
- }//GEN-END:initComponents
-
- private void okButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okButtonActionPerformed
- doClose(RET_OK);
- }//GEN-LAST:event_okButtonActionPerformed
-
- private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed
- doClose(RET_CANCEL);
- }//GEN-LAST:event_cancelButtonActionPerformed
-
- /** Closes the dialog */
- private void closeDialog(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_closeDialog
- doClose(RET_CANCEL);
- }//GEN-LAST:event_closeDialog
-
- private void doClose(int retStatus) {
- returnStatus = retStatus;
- setVisible(false);
- dispose();
- }
-
- /**
- * param args the command line arguments
- */
- public static void main(String args[]) {
- new OKDialog(new javax.swing.JFrame(), true).show();
- }
-
- // Variables declaration - do not modify//GEN-BEGIN:variables
- private javax.swing.JPanel buttonPanel;
- private javax.swing.JButton okButton;
- private javax.swing.JButton cancelButton;
- // End of variables declaration//GEN-END:variables
-
- private int returnStatus = RET_CANCEL;
- }]]>
- </File>
- </TemplateFiles>
-
- <FileOptions/>
-
- </Template>
-