/* * DeleteQuestionDialog.java * * Created on May 20, 2004, 12:36 PM */ package cz.muni.fi.bronchus.gui; /** * * @author xudrzal */ public class DeleteQuestionDialog extends MyCentralizedJDialog { public int YES_OPTION=0; public int NO_OPTION=-1; public int CANCEL_OPTION=-2; private int selected=0; private MyResources myResources; /** Creates new form DeleteQuestionDialog */ public DeleteQuestionDialog(java.awt.Frame parent, boolean modal, MyResources res) { super(parent, modal); myResources = res; initComponents(); } public DeleteQuestionDialog(javax.swing.JDialog parent, boolean modal, MyResources res) { super(parent, modal); myResources = res; 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 jPanel1 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); jTextField1 = new javax.swing.JTextField(); jButton1 = new javax.swing.JButton(); jButton2 = new javax.swing.JButton(); jButton3 = new javax.swing.JButton(); getContentPane().setLayout(new java.awt.FlowLayout()); addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent evt) { closeDialog(evt); } }); jPanel1.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); jPanel1.setBorder(new javax.swing.border.EtchedBorder()); jPanel1.setPreferredSize(new java.awt.Dimension(280, 100)); jLabel1.setFont(new java.awt.Font("Dialog", 0, 11)); jLabel1.setText(myResources.getBundle("cz/muni/fi/bronchus/bundles/DeleteQuestionDialogBundle", "Do_you_really_want_to_delete_following_rows?")); jPanel1.add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 10, -1, -1)); jTextField1.setEditable(false); jTextField1.setFont(new java.awt.Font("Dialog", 0, 11)); jTextField1.setPreferredSize(new java.awt.Dimension(260, 19)); jPanel1.add(jTextField1, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 30, -1, -1)); jButton1.setFont(new java.awt.Font("Dialog", 0, 11)); jButton1.setText(myResources.getBundle("cz/muni/fi/bronchus/bundles/DeleteQuestionDialogBundle", "Yes")); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); jPanel1.add(jButton1, new org.netbeans.lib.awtextra.AbsoluteConstraints(55, 60, -1, -1)); jButton2.setFont(new java.awt.Font("Dialog", 0, 11)); jButton2.setText(myResources.getBundle("cz/muni/fi/bronchus/bundles/DeleteQuestionDialogBundle", "No")); jButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt); } }); jPanel1.add(jButton2, new org.netbeans.lib.awtextra.AbsoluteConstraints(115, 60, -1, -1)); jButton3.setFont(new java.awt.Font("Dialog", 0, 11)); jButton3.setText(myResources.getBundle("cz/muni/fi/bronchus/bundles/DeleteQuestionDialogBundle", "Cancel")); jButton3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton3ActionPerformed(evt); } }); jPanel1.add(jButton3, new org.netbeans.lib.awtextra.AbsoluteConstraints(170, 60, -1, -1)); getContentPane().add(jPanel1); pack(); }//GEN-END:initComponents private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed // Add your handling code here: selected=0; setVisible(false); dispose(); }//GEN-LAST:event_jButton1ActionPerformed private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed // Add your handling code here: selected=-1; setVisible(false); dispose(); }//GEN-LAST:event_jButton2ActionPerformed private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed // Add your handling code here: selected=-2; setVisible(false); dispose(); }//GEN-LAST:event_jButton3ActionPerformed /** Closes the dialog */ private void closeDialog(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_closeDialog selected=-2; setVisible(false); dispose(); }//GEN-LAST:event_closeDialog public void setQuestions(String questions) { jTextField1.setText(questions); } public int showDialog() { setVisible(true); return selected; } /** * @param args the command line arguments */ public static void main(String args[]) { new DeleteQuestionDialog(new javax.swing.JFrame(), true, null).setVisible(true); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton jButton1; private javax.swing.JButton jButton2; private javax.swing.JButton jButton3; private javax.swing.JLabel jLabel1; private javax.swing.JPanel jPanel1; private javax.swing.JTextField jTextField1; // End of variables declaration//GEN-END:variables }