je voudrais réaliser une application d'évaluation de qcm et j'ai un rpobléme pour recupere une question avec sa liste de réponse correspondant dans une base de données ( wamp server )
une question doit s'affcher puis une liste de réponse a cocher
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/*
* QCM2.java
*
* Created on 2 juin 2012, 02:41:40
*/
package IHM;
/**
*
* @author Administrateur
*/
public class QCM2 extends javax.swing.JFrame {
private Timer timer2;
private PreparedStatement st = null;
private TimerTask time2 = new TimerTask() {
@Override
/**
* Tache a faire toute les seconde
*/
public void run() {
//a faire
if (temps.getText().equals("120")) {
JOptionPane.showMessageDialog(rootPane, "Temps imparti ecoulé le programme va se fermer!");
dispose();
}
temps.setText("" + Chrono.getNbSec());
}
};
private Connection con = null;
/**
* Creates new form QCM2
*/
public QCM2(Utilisateur ut, String theme) {
setVisible(true);
initComponents();
user.setText(ut.getPrenom() + " " + ut.getNom());
th.setText(theme);
timer2 = new Timer();
timer2.schedule(time2, 0, 1000);
}
/**
* 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.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
div = new javax.swing.JLabel();
th = new javax.swing.JLabel();
REP2 = new javax.swing.JCheckBox();
question = new javax.swing.JLabel();
REP1 = new javax.swing.JCheckBox();
REP3 = new javax.swing.JCheckBox();
REP4 = new javax.swing.JCheckBox();
user = new javax.swing.JLabel();
BtnValider = new javax.swing.JButton();
BtnSuivant = new javax.swing.JButton();
res = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
jLabel1 = new javax.swing.JLabel();
temps = new javax.swing.JLabel();
String c = div.getText();
int i = Integer.parseInt(c);
i++;
if (i > 5) {
JOptionPane.showMessageDialog(rootPane, "Fin du TesT");
dispose();
}
question.setText("LIBELLE DE LA QUESTION " + i);
REP1.setText("REPONSE N° " + (i + 4));
REP2.setText("REPONSE N° " + (i + 5));
REP3.setText("REPONSE N° " + (i + 6));
REP4.setText("REPONSE N° " + (i + 7));
div.setText("" + i);
BtnValider.setVisible(true);
// TODO add your handling code here:
}
private void REP1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void formFocusGained(java.awt.event.FocusEvent evt) {
// TODO add your handling code here:
}
/**
* @param args the command line arguments
*/
// Variables declaration - do not modify
private javax.swing.JButton BtnSuivant;
private javax.swing.JButton BtnValider;
private javax.swing.JCheckBox REP1;
private javax.swing.JCheckBox REP2;
private javax.swing.JCheckBox REP3;
private javax.swing.JCheckBox REP4;
private javax.swing.JLabel div;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel question;
private javax.swing.JLabel res;
private javax.swing.JLabel temps;
private javax.swing.JLabel th;
private javax.swing.JLabel user;
// End of variables declaration
}