/* * MoveQuestionDialog.java * * Created on May 20, 2004, 2:36 PM */ package cz.muni.fi.bronchus.gui; import java.util.ArrayList; /** * * @author xudrzal */ public class MoveQuestionDialog extends MyCentralizedJDialog { private int selected=-1; private MyResources myResources; /** Creates new form MoveQuestionDialog */ public MoveQuestionDialog(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 buttonGroup1 = new javax.swing.ButtonGroup(); jPanel1 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); jRadioButton1 = new javax.swing.JRadioButton(); jRadioButton2 = new javax.swing.JRadioButton(); jLabel2 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); jButton1 = new javax.swing.JButton(); jButton2 = new javax.swing.JButton(); jComboBox1 = new javax.swing.JComboBox(); getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); 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(300, 150)); jLabel1.setFont(new java.awt.Font("Dialog", 0, 11)); jLabel1.setText(myResources.getBundle("cz/muni/fi/bronchus/bundles/MoveQuestionDialogBundle", "Moving_item:__")); jPanel1.add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 10, -1, -1)); buttonGroup1.add(jRadioButton1); jRadioButton1.setFont(new java.awt.Font("Dialog", 0, 11)); jRadioButton1.setSelected(true); jRadioButton1.setText(myResources.getBundle("cz/muni/fi/bronchus/bundles/MoveQuestionDialogBundle", "insert_before_another_item")); jPanel1.add(jRadioButton1, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 25, -1, -1)); buttonGroup1.add(jRadioButton2); jRadioButton2.setFont(new java.awt.Font("Dialog", 0, 11)); jRadioButton2.setText(myResources.getBundle("cz/muni/fi/bronchus/bundles/MoveQuestionDialogBundle", "insert_at_the_end_of_the_list")); jPanel1.add(jRadioButton2, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 70, -1, -1)); jLabel2.setFont(new java.awt.Font("Dialog", 0, 11)); jPanel1.add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(100, 10, -1, -1)); jLabel4.setFont(new java.awt.Font("Dialog", 0, 11)); jLabel4.setText(myResources.getBundle("cz/muni/fi/bronchus/bundles/MoveQuestionDialogBundle", "If_you_aren't_sure_of_the_correct_number_to_use,_
click_[Cancel],_find_the_correct_number_in_the_
question_list_and_press_[Move]_again")); jPanel1.add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 100, -1, -1)); jButton1.setFont(new java.awt.Font("Dialog", 0, 11)); jButton1.setText(myResources.getBundle("cz/muni/fi/bronchus/bundles/MoveQuestionDialogBundle", "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(220, 10, -1, -1)); jButton2.setFont(new java.awt.Font("Dialog", 0, 11)); jButton2.setText(myResources.getBundle("cz/muni/fi/bronchus/bundles/MoveQuestionDialogBundle", "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(220, 40, -1, -1)); jComboBox1.setFont(new java.awt.Font("Dialog", 0, 11)); jComboBox1.setPreferredSize(new java.awt.Dimension(70, 20)); jPanel1.add(jComboBox1, new org.netbeans.lib.awtextra.AbsoluteConstraints(50, 50, -1, -1)); getContentPane().add(jPanel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1)); pack(); }//GEN-END:initComponents private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed // Add your handling code here: if (jRadioButton1.isSelected()) { if (((String)jComboBox1.getSelectedItem()).compareTo(jLabel2.getText())!=0) { selected=jComboBox1.getSelectedIndex(); } else { selected=-1; } } else { selected=jComboBox1.getItemCount(); } 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 /** Closes the dialog */ private void closeDialog(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_closeDialog selected=-1; setVisible(false); dispose(); }//GEN-LAST:event_closeDialog public int showDialog(String movingItem, ArrayList list) { jLabel2.setText(movingItem); for (int i=0; i