/*
* InsertQuestionDialog.java
*
* Created on June 10, 2004, 2:08 PM
*/
package cz.muni.fi.bronchus.gui;
import cz.muni.fi.bronchus.questions.*;
import java.util.ArrayList;
/**
*
* @author xudrzal
*/
public class InsertQuestionDialog extends MyCentralizedJDialog {
private int selected=-1;
private MyResources myResources;
/** Creates new form InsertQuestionDialog */
public InsertQuestionDialog(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();
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(270, 115));
jLabel1.setFont(new java.awt.Font("Dialog", 0, 11));
jLabel1.setText(myResources.getBundle("cz/muni/fi/bronchus/bundles/InsertQuestionDialogBundle", "Insert_Question_before_item:__"));
jPanel1.add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 10, -1, -1));
jLabel2.setFont(new java.awt.Font("Dialog", 0, 11));
jPanel1.add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(80, 10, -1, -1));
jLabel4.setFont(new java.awt.Font("Dialog", 0, 11));
jLabel4.setText(myResources.getBundle("cz/muni/fi/bronchus/bundles/InsertQuestionDialogBundle", "If_you_aren't_sure_of_the_correct_number_to_use,_
_click_[Cancel],_find_the_correct_number_in_the_
question_list_and_press_[Insert_into_List]_again"));
jPanel1.add(jLabel4, 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/InsertQuestionDialogBundle", "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(100, 80, -1, -1));
jButton2.setFont(new java.awt.Font("Dialog", 0, 11));
jButton2.setText(myResources.getBundle("cz/muni/fi/bronchus/bundles/InsertQuestionDialogBundle", "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(180, 80, -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(170, 7, -1, -1));
getContentPane().add(jPanel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1));
pack();
}//GEN-END:initComponents
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 jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
// Add your handling code here:
selected=jComboBox1.getSelectedIndex();
setVisible(false);
dispose();
}//GEN-LAST:event_jButton1ActionPerformed
/** 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(ArrayList list) {
for (int i=0; i