|
What this is
Other links
The source code/* * QuestionDialog.java * * Created on November 15, 2002, 6:48 PM */ package org.netbeans.test.editor.app.gui; /** * * @author eh103527 */ public class QuestionDialog extends javax.swing.JDialog { boolean answer=false; /** Creates new form QuestionDialog */ public QuestionDialog(java.awt.Frame parent, String quest) { super(parent, true); initComponents(); textL.setText(quest); pack(); setLocation(parent.getX()+(parent.getWidth()-getWidth())/2,parent.getY()+(parent.getHeight()-getHeight())/2); } /** 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 jPanel1 = new javax.swing.JPanel(); textL = new javax.swing.JLabel(); jPanel2 = new javax.swing.JPanel(); yesB = new javax.swing.JButton(); noB = new javax.swing.JButton(); setTitle("Question"); setModal(true); setResizable(false); addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent evt) { closeDialog(evt); } }); textL.setFont(new java.awt.Font("Dialog", 1, 14)); jPanel1.add(textL); getContentPane().add(jPanel1, java.awt.BorderLayout.CENTER); jPanel2.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.CENTER, 10, 10)); yesB.setText("Yes"); yesB.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { yesBActionPerformed(evt); } }); jPanel2.add(yesB); noB.setText("No"); noB.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { noBActionPerformed(evt); } }); jPanel2.add(noB); getContentPane().add(jPanel2, java.awt.BorderLayout.SOUTH); pack(); }//GEN-END:initComponents private void noBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_noBActionPerformed // Add your handling code here: answer=false; close(); }//GEN-LAST:event_noBActionPerformed private void yesBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_yesBActionPerformed // Add your handling code here: answer=true; close(); }//GEN-LAST:event_yesBActionPerformed /** Closes the dialog */ private void closeDialog(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_closeDialog answer=false; close(); }//GEN-LAST:event_closeDialog private void close() { setVisible(false); dispose(); } /** Getter for property answer. * @return Value of property answer. * */ public boolean getAnswer() { return answer; } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JLabel textL; private javax.swing.JButton noB; private javax.swing.JButton yesB; private javax.swing.JPanel jPanel2; private javax.swing.JPanel jPanel1; // End of variables declaration//GEN-END:variables } |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.