package cz.muni.fi.bronchus.gui; /* * RewriteDialog.java * * Created on 21. duben 2005, 8:40 */ /** * * @author xudrzal */ public class RewriteDialog extends MyCentralizedJDialog { public static int CANCEL_OPTION=-1; public static int OK_NOT_OVERWRITE_OPTION=0; public static int OK_OVERWRITE_OPTION=1; private int selected=-1; private MyResources myResources; /** Creates new form RewriteDialog */ public RewriteDialog(java.awt.Frame 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(); jCheckBox1 = new javax.swing.JCheckBox(); jButton1 = new javax.swing.JButton(); jButton2 = new javax.swing.JButton(); getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); setResizable(false); jPanel1.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); jPanel1.setPreferredSize(new java.awt.Dimension(225, 90)); jLabel1.setFont(new java.awt.Font("Dialog", 0, 11)); jLabel1.setText(myResources.getBundle("cz/muni/fi/bronchus/bundles/RewriteDialogBundle", "File exists. Do you want to overwrite it?")); jPanel1.add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 20, -1, -1)); jCheckBox1.setFont(new java.awt.Font("Dialog", 0, 11)); jCheckBox1.setSelected(true); jCheckBox1.setText(myResources.getBundle("cz/muni/fi/bronchus/bundles/RewriteDialogBundle", "overwrite associated files")); jPanel1.add(jCheckBox1, new org.netbeans.lib.awtextra.AbsoluteConstraints(50, 50, -1, -1)); jButton1.setFont(new java.awt.Font("Dialog", 0, 11)); jButton1.setText(myResources.getBundle("cz/muni/fi/bronchus/bundles/RewriteDialogBundle", "OK")); jButton1.setPreferredSize(new java.awt.Dimension(70, 24)); 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(50, 90, -1, -1)); jButton2.setFont(new java.awt.Font("Dialog", 0, 11)); jButton2.setText(myResources.getBundle("cz/muni/fi/bronchus/bundles/RewriteDialogBundle", "Cancel")); 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(140, 90, -1, -1)); getContentPane().add(jPanel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 270, 130)); pack(); }//GEN-END:initComponents private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed // TODO add your handling code here: if (jCheckBox1.isSelected()) selected=OK_OVERWRITE_OPTION; else selected=OK_NOT_OVERWRITE_OPTION; setVisible(false); dispose(); }//GEN-LAST:event_jButton1ActionPerformed private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed // TODO add your handling code here: selected=CANCEL_OPTION; setVisible(false); dispose(); }//GEN-LAST:event_jButton2ActionPerformed public int showDialog() { setVisible(true); return selected; } /** * @param args the command line arguments */ public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new RewriteDialog(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.JCheckBox jCheckBox1; private javax.swing.JLabel jLabel1; private javax.swing.JPanel jPanel1; // End of variables declaration//GEN-END:variables }