Créé dans le cadre du projet de fin d'année de la promo 2018 de CIR2 de l'ISEN Brest/Rennes, le Burger Quizz est une adaptation numérique du jeu télévisé éponyme, plus précisément d'une épreuve spécifique de ce jeu : le "Sel ou Poivre".

InterfacePrincipale.java 18KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612
  1. import javax.swing.*;
  2. import javax.swing.border.Border;
  3. import javax.swing.event.ListSelectionEvent;
  4. import javax.swing.event.ListSelectionListener;
  5. import java.awt.*;
  6. import java.awt.event.ActionEvent;
  7. import java.awt.event.ActionListener;
  8. import java.util.Arrays;
  9. import java.util.Vector;
  10. import static java.lang.Thread.sleep;
  11. import static javax.swing.BoxLayout.*;
  12. public class InterfacePrincipale extends JFrame
  13. {
  14. //Panel des catégories
  15. private JPanel panCategories;
  16. private Bouton addC;
  17. private Bouton delC;
  18. private Bouton editC;
  19. private JList listC;
  20. //Panel des réponses
  21. private JPanel panReponses;
  22. private Bouton addR;
  23. private Bouton delR;
  24. private Bouton editR;
  25. private JList listR;
  26. //Panel des questions
  27. private JPanel panQuestions;
  28. private Bouton addQ;
  29. private Bouton delQ;
  30. private Bouton editQ;
  31. private JList listQ;
  32. //image pour les boutons
  33. private ImageIcon plusImg;
  34. private ImageIcon delImg;
  35. private ImageIcon editImg;
  36. private ImageIcon setupImg;
  37. //barre de statut
  38. private JPanel statusBar;
  39. private JLabel statusText;
  40. private Bouton config;
  41. //objet bdd
  42. private ConnexionBDD bdd;
  43. private ConfigBDD configBDD;
  44. public InterfacePrincipale()
  45. {
  46. configBDD = new ConfigBDD();
  47. configBDD.loadConf();
  48. bdd = new ConnexionBDD();
  49. tryToConnect();
  50. setTitle("Administration base de données de l'aplication BurgerQuizz");
  51. setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  52. setLayout(new BorderLayout());
  53. loadImgBouton();
  54. createPanelCategories();
  55. createPanelReponses();
  56. createPanelQuestion();
  57. createStatusBar();
  58. JSplitPane sp2 = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,true,panReponses,panQuestions);
  59. JSplitPane sp1 = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,true,panCategories,sp2);
  60. sp1.setBorder(BorderFactory.createLineBorder(new Color(238,238,238),5));
  61. sp2.setBorder(BorderFactory.createEmptyBorder());
  62. sp1.setDividerSize(10);
  63. sp2.setDividerSize(10);
  64. JPanel conteneur = new JPanel();
  65. conteneur.setLayout(new BorderLayout());
  66. conteneur.setBorder(BorderFactory.createEmptyBorder(0,5,0,5));
  67. conteneur.add(sp1, BorderLayout.CENTER);
  68. Color bg = new Color(220,220,220);
  69. panQuestions.setBackground(bg);
  70. panReponses.setBackground(bg);
  71. panCategories.setBackground(bg);
  72. getContentPane().add(new JLabel(new ImageIcon("rsc/burgerquizz.png")), BorderLayout.NORTH);
  73. getContentPane().add(conteneur, BorderLayout.CENTER);
  74. getContentPane().add(statusBar, BorderLayout.SOUTH);
  75. pack();
  76. sp1.setDividerLocation(0.30);
  77. sp2.setDividerLocation(0.50);
  78. setLocationRelativeTo(null);
  79. setVisible(true);
  80. }
  81. private void loadImgBouton()
  82. {
  83. plusImg = new ImageIcon("rsc/plus.png");
  84. delImg = new ImageIcon("rsc/del.png");
  85. editImg = new ImageIcon("rsc/edit.png");
  86. setupImg = new ImageIcon("rsc/cle.png");
  87. }
  88. private void createStatusBar()
  89. {
  90. statusBar = new JPanel(new BorderLayout(0,0));
  91. statusText = new JLabel("Application demarrée, connexion à la base de donné effective. ");
  92. Border border = BorderFactory.createMatteBorder(3,0,0,0, new Color(220,220,220));
  93. statusBar.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(10,70,5,70),border));
  94. statusText.setHorizontalAlignment(SwingConstants.CENTER);
  95. config = new Bouton("Configuration", setupImg);
  96. config.setPreferredSize(new Dimension(200, 34));
  97. JPanel p = new JPanel();
  98. p.setLayout(new BorderLayout());
  99. p.add(config, BorderLayout.CENTER);
  100. p.setBorder(BorderFactory.createEmptyBorder(5,0,0,0));
  101. statusBar.add(statusText, BorderLayout.CENTER);
  102. statusBar.add(p, BorderLayout.EAST);
  103. config.addActionListener(new ActionListener() {
  104. public void actionPerformed(ActionEvent actionEvent) {
  105. configureBDD(false);
  106. tryToConnect();
  107. listC.setListData(bdd.getListeCategorie().toArray());
  108. listR.setListData(new Vector(0));
  109. listQ.setListData(new Vector(0));
  110. }
  111. });
  112. }
  113. private void createPanelCategories()
  114. {
  115. panCategories = new JPanel();
  116. addC = new Bouton("Ajouter une catégorie", plusImg);
  117. delC = new Bouton("Supprimer la catégorie", delImg);
  118. editC = new Bouton("Modifier la catégorie", editImg);
  119. listC = new JList(bdd.getListeCategorie().toArray());
  120. JScrollPane sp = new JScrollPane(listC,
  121. JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
  122. JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
  123. panCategories.setLayout(new BoxLayout(panCategories,Y_AXIS));
  124. panCategories.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
  125. addC.setAlignmentX(CENTER_ALIGNMENT);
  126. delC.setAlignmentX(CENTER_ALIGNMENT);
  127. editC.setAlignmentX(CENTER_ALIGNMENT);
  128. addC.setMaximumSize(new Dimension(208,34));
  129. delC.setMaximumSize(new Dimension(208,34));
  130. editC.setMaximumSize(new Dimension(208,34));
  131. JLabel labC = new JLabel("Catégories");
  132. labC.setAlignmentX(Component.CENTER_ALIGNMENT);
  133. labC.setBorder(BorderFactory.createEmptyBorder(0,0,10,0));
  134. panCategories.add(labC);
  135. panCategories.add(addC);
  136. panCategories.add(Box.createRigidArea(new Dimension(1,5)));
  137. panCategories.add(delC);
  138. panCategories.add(Box.createRigidArea(new Dimension(1,10)));
  139. panCategories.add(sp);
  140. panCategories.add(Box.createRigidArea(new Dimension(1,10)));
  141. panCategories.add(editC);
  142. PanCategoriesListener pcl = new PanCategoriesListener();
  143. addC.addActionListener(pcl);
  144. delC.addActionListener(pcl);
  145. editC.addActionListener(pcl);
  146. listC.addListSelectionListener(pcl);
  147. }
  148. private void createPanelReponses()
  149. {
  150. panReponses = new JPanel();
  151. addR = new Bouton("Ajouter un jeu de réponses", plusImg);
  152. delR = new Bouton("Supprimer le jeu de réponses", delImg);
  153. editR = new Bouton("Modifier le jeu de réponse", editImg);
  154. listR = new JList();
  155. JScrollPane sp = new JScrollPane(listR,
  156. JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
  157. JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
  158. panReponses.setLayout(new BoxLayout(panReponses,Y_AXIS));
  159. panReponses.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
  160. addR.setAlignmentX(CENTER_ALIGNMENT);
  161. delR.setAlignmentX(CENTER_ALIGNMENT);
  162. editR.setAlignmentX(CENTER_ALIGNMENT);
  163. addR.setMaximumSize(new Dimension(300,34));
  164. delR.setMaximumSize(new Dimension(300,34));
  165. editR.setMaximumSize(new Dimension(300,34));
  166. JLabel labR = new JLabel("Réponses");
  167. labR.setAlignmentX(Component.CENTER_ALIGNMENT);
  168. labR.setBorder(BorderFactory.createEmptyBorder(0,0,10,0));
  169. panReponses.add(labR);
  170. panReponses.add(addR);
  171. panReponses.add(Box.createRigidArea(new Dimension(1,5)));
  172. panReponses.add(delR);
  173. panReponses.add(Box.createRigidArea(new Dimension(1, 10)));
  174. panReponses.add(sp);
  175. panReponses.add(Box.createRigidArea(new Dimension(1, 10)));
  176. panReponses.add(editR);
  177. PanReponsesListener prl = new PanReponsesListener();
  178. addR.addActionListener(prl);
  179. delR.addActionListener(prl);
  180. editR.addActionListener(prl);
  181. listR.addListSelectionListener(prl);
  182. }
  183. private void createPanelQuestion()
  184. {
  185. panQuestions = new JPanel();
  186. addQ = new Bouton("Ajouter une question", plusImg);
  187. delQ = new Bouton("Supprimer la question", delImg);
  188. editQ = new Bouton("Modifier la question", editImg);
  189. listQ = new JList();
  190. JScrollPane sp = new JScrollPane(listQ,
  191. JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
  192. JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
  193. panQuestions.setLayout(new BoxLayout(panQuestions,Y_AXIS));
  194. panQuestions.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
  195. addQ.setAlignmentX(CENTER_ALIGNMENT);
  196. delQ.setAlignmentX(CENTER_ALIGNMENT);
  197. editQ.setAlignmentX(CENTER_ALIGNMENT);
  198. addQ.setMaximumSize(new Dimension(208,34));
  199. delQ.setMaximumSize(new Dimension(208,34));
  200. editQ.setMaximumSize(new Dimension(208,34));
  201. JLabel labQ = new JLabel("Questions");
  202. labQ.setAlignmentX(Component.CENTER_ALIGNMENT);
  203. labQ.setBorder(BorderFactory.createEmptyBorder(0,0,10,0));
  204. panQuestions.add(labQ);
  205. panQuestions.add(addQ);
  206. panQuestions.add(Box.createRigidArea(new Dimension(1,5)));
  207. panQuestions.add(delQ);
  208. panQuestions.add(Box.createRigidArea(new Dimension(1, 10)));
  209. panQuestions.add(sp);
  210. panQuestions.add(Box.createRigidArea(new Dimension(1, 10)));
  211. panQuestions.add(editQ);
  212. PanQuestionsListener pql = new PanQuestionsListener();
  213. addQ.addActionListener(pql);
  214. delQ.addActionListener(pql);
  215. editQ.addActionListener(pql);
  216. }
  217. public void modem56k()
  218. {
  219. int i =0;
  220. while(i != 500)
  221. {
  222. this.setSize(1000, i);
  223. try
  224. {
  225. sleep(100);
  226. }
  227. catch(InterruptedException e)
  228. {}
  229. i++;
  230. }
  231. }
  232. public void nyan()
  233. {
  234. BorderLayout bl = (BorderLayout)getContentPane().getLayout();
  235. JLabel l = (JLabel)bl.getLayoutComponent(BorderLayout.NORTH);
  236. l.setIcon(new ImageIcon("rsc/nyan.gif"));
  237. setLocationRelativeTo(null);
  238. pack();
  239. }
  240. public void configureBDD(boolean showExitButton)
  241. {
  242. ConnexionBddDialog cbddd = new ConnexionBddDialog(configBDD.getNomBdd(), configBDD.getPort(),
  243. configBDD.getIp(), configBDD.getLogin(),
  244. configBDD.getPassword(), null, showExitButton);
  245. if(cbddd.afficher() == true)
  246. {
  247. configBDD.setNomBdd(cbddd.getNomBdd());
  248. configBDD.setIp(cbddd.getIp());
  249. configBDD.setPort(cbddd.getPort());
  250. configBDD.setLogin(cbddd.getLogin());
  251. configBDD.setPassword(cbddd.getPassword());
  252. configBDD.saveConf();
  253. }
  254. }
  255. private void tryToConnect()
  256. {
  257. boolean conOK = false;
  258. do
  259. {
  260. conOK = bdd.connect(configBDD.getNomBdd(), configBDD.getPort(), configBDD.getIp(), configBDD.getLogin(), configBDD.getPassword());
  261. if(conOK == false)
  262. {
  263. JOptionPane.showMessageDialog(this, "Impossible d'établir la connexion à la base de données.", "Erreur conexion base de données", JOptionPane.ERROR_MESSAGE);
  264. configureBDD(true);
  265. }
  266. }while(!conOK);
  267. }
  268. private void reSelectCategorie(String newCatName)
  269. {
  270. Object[] tabObject = bdd.getListeCategorie().toArray();
  271. Categorie[] tabCategorie = Arrays.copyOf(tabObject, tabObject.length, Categorie[].class);
  272. listC.setListData(tabCategorie);
  273. for(int i=0; i<tabCategorie.length; i++)
  274. {
  275. if(tabCategorie[i].getNom().equals(newCatName))
  276. {
  277. listC.setSelectedValue(tabCategorie[i], true);
  278. break;
  279. }
  280. }
  281. }
  282. private void reSelectReponses(String rep1, String rep2)
  283. {
  284. Object[] tabObject = bdd.getListeReponses(listC.getSelectedValue().toString()).toArray();
  285. Reponses[] tabReponses = Arrays.copyOf(tabObject, tabObject.length, Reponses[].class);
  286. listR.setListData(tabReponses);
  287. for(int i=0; i<tabReponses.length; i++)
  288. {
  289. if(tabReponses[i].getReponse1().equals(rep1) && tabReponses[i].getReponse2().equals(rep2))
  290. {
  291. listR.setSelectedValue(tabReponses[i], true);
  292. break;
  293. }
  294. }
  295. }
  296. private void reSelectQuestion(String intitule)
  297. {
  298. Reponses r = (Reponses) listR.getSelectedValue();
  299. Object[] tabObject = bdd.getListeQuestions(r.getReponse1(), r.getReponse2()).toArray();
  300. Question[] tabQuestions = Arrays.copyOf(tabObject, tabObject.length, Question[].class);
  301. listQ.setListData(tabQuestions);
  302. for(int i=0; i<tabQuestions.length; i++)
  303. {
  304. if(tabQuestions[i].getIntitule().equals(intitule))
  305. {
  306. listQ.setSelectedValue(tabQuestions[i], true);
  307. break;
  308. }
  309. }
  310. }
  311. private String[] getCategorieList()
  312. {
  313. ListModel model = listC.getModel();
  314. String[] tabCategories = new String[model.getSize()];
  315. for(int i=0; i < model.getSize(); i++)
  316. {
  317. Categorie c = (Categorie)model.getElementAt(i);
  318. tabCategories[i] = c.getNom();
  319. }
  320. return tabCategories;
  321. }
  322. private class PanCategoriesListener implements ActionListener, ListSelectionListener
  323. {
  324. public void actionPerformed(ActionEvent e)
  325. {
  326. if(e.getSource() == addC)
  327. {
  328. String catName = JOptionPane.showInputDialog(null,
  329. "Nom de la nouvelle categorie:",
  330. "Nouvelle catégorie",
  331. JOptionPane.QUESTION_MESSAGE);
  332. if(catName == null)
  333. {
  334. return ;
  335. }
  336. else if(catName.isEmpty())
  337. {
  338. statusText.setText("Une categorie ne peut porter un nom vide.");
  339. return ;
  340. }
  341. bdd.createCategorie(catName);
  342. //listC.setListData(bdd.getListeCategorie().toArray());
  343. reSelectCategorie(catName);
  344. listQ.setListData(new Vector(0));
  345. }
  346. else if(e.getSource() == delC)
  347. {
  348. Categorie c = (Categorie) listC.getSelectedValue();
  349. if(c == null)
  350. {
  351. statusText.setText("Veuiller d'abord selectionner une categorie.");
  352. return;
  353. }
  354. String categorieName = c.getNom();
  355. if(JOptionPane.showConfirmDialog(null, "Voulez vous vraiment supprimer la catégorie " + categorieName + " ?\nCela supprimera aussi toute les reponses et questions associé à cette catégorie.", "Supression de catégorie", JOptionPane.OK_CANCEL_OPTION) == JOptionPane.OK_OPTION)
  356. {
  357. bdd.deleteCategorie(categorieName);
  358. listC.setListData(bdd.getListeCategorie().toArray());
  359. listR.setListData(new Vector(0));
  360. listQ.setListData(new Vector(0));
  361. }
  362. }
  363. else if(e.getSource() == editC)
  364. {
  365. Categorie c = (Categorie) listC.getSelectedValue();
  366. if(c == null)
  367. {
  368. statusText.setText("Veuiller d'abord selectionner une categorie.");
  369. return;
  370. }
  371. String oldCatName = c.getNom();
  372. String newCatName = JOptionPane.showInputDialog(null,
  373. "Nouveau nom pour la categorie " + oldCatName + ":",
  374. "Renomer catégorie",
  375. JOptionPane.QUESTION_MESSAGE);
  376. if(newCatName == null)
  377. {
  378. return ;
  379. }
  380. else if(newCatName.isEmpty())
  381. {
  382. statusText.setText("Une categorie ne peut porter un nom vide.");
  383. return ;
  384. }
  385. bdd.renameCategorie(oldCatName, newCatName);
  386. reSelectCategorie(newCatName);
  387. }
  388. }
  389. public void valueChanged(ListSelectionEvent e)
  390. {
  391. if(!listC.isSelectionEmpty())
  392. {
  393. listR.setListData(bdd.getListeReponses(listC.getSelectedValue().toString()).toArray());
  394. listQ.setListData(new Vector(0));
  395. }
  396. }
  397. }
  398. private class PanReponsesListener implements ActionListener, ListSelectionListener
  399. {
  400. public void actionPerformed(ActionEvent e)
  401. {
  402. if(listC.isSelectionEmpty())
  403. {
  404. statusText.setText("Veuillez selectioner une catégorie.");
  405. return;
  406. }
  407. if(e.getSource() == addR)
  408. {
  409. NouvelleReponseDialog nrd = new NouvelleReponseDialog("Nouveau jeu de réponses", "", "", null, null, null);
  410. if(nrd.afficher() == true)
  411. {
  412. String catName = listC.getSelectedValue().toString();
  413. bdd.createReponses(catName, nrd.getRep1(), nrd.getRep2());
  414. //listR.setListData(bdd.getListeReponses(catName).toArray());
  415. reSelectReponses(nrd.getRep1(), nrd.getRep2());
  416. }
  417. }
  418. else if(e.getSource() == delR)
  419. {
  420. Reponses r = (Reponses) listR.getSelectedValue();
  421. if(r == null)
  422. {
  423. statusText.setText("Veuiller d'abord selectionner un jeu de réponses.");
  424. return;
  425. }
  426. String reponse1 = r.getReponse1();
  427. String reponse2 = r.getReponse2();
  428. if(JOptionPane.showConfirmDialog(null,"Voulez vous vraiment supprimer le jeu de réponses " + reponse1 + ", " + reponse2 + " ?\nCela supprimera aussi toutes les questions associé à cette catégorie.", "Supression de réponses", JOptionPane.OK_CANCEL_OPTION) == JOptionPane.OK_OPTION)
  429. {
  430. bdd.deleteReponses(reponse1, reponse2);
  431. listR.setListData(bdd.getListeReponses(listC.getSelectedValue().toString()).toArray());
  432. listQ.setListData(new Vector(0));
  433. }
  434. }
  435. else if(e.getSource() == editR)
  436. {
  437. Reponses r = (Reponses) listR.getSelectedValue();
  438. if(r == null)
  439. {
  440. statusText.setText("Veuiller d'abord selectionner un jeu de réponses.");
  441. return;
  442. }
  443. String reponse1 = r.getReponse1();
  444. String reponse2 = r.getReponse2();
  445. String catName = listC.getSelectedValue().toString();
  446. NouvelleReponseDialog nrd = new NouvelleReponseDialog("Modification jeu de réponses", reponse1, reponse2, catName, getCategorieList(), null);
  447. if(nrd.afficher() == true)
  448. {
  449. bdd.modifyReponses(nrd.getCat(), reponse1, reponse2, nrd.getRep1(), nrd.getRep2());
  450. //listR.setListData(bdd.getListeReponses(catName).toArray());
  451. reSelectCategorie(nrd.getCat());
  452. reSelectReponses(nrd.getRep1(), nrd.getRep2());
  453. }
  454. }
  455. }
  456. public void valueChanged(ListSelectionEvent listSelectionEvent)
  457. {
  458. if(!listR.isSelectionEmpty())
  459. {
  460. Reponses r = (Reponses) listR.getSelectedValue();
  461. listQ.setListData(bdd.getListeQuestions(r.getReponse1(), r.getReponse2()).toArray());
  462. }
  463. }
  464. }
  465. private class PanQuestionsListener implements ActionListener
  466. {
  467. public void actionPerformed(ActionEvent e)
  468. {
  469. if(listR.isSelectionEmpty())
  470. {
  471. statusText.setText("Veuillez selectioner une sous-catégorie.");
  472. return;
  473. }
  474. if(e.getSource() == addQ)
  475. {
  476. Reponses r = (Reponses) listR.getSelectedValue();
  477. NouvelleQuestionDialog nqd = new NouvelleQuestionDialog("Nouvelle question", "",
  478. 0, r.getReponse1(),r.getReponse2(), null);
  479. if(nqd.afficher() == true)
  480. {
  481. bdd.createQuestion(nqd.getIntitule(), r.getReponse1(), r.getReponse2(), nqd.getReponse());
  482. //listQ.setListData(bdd.getListeQuestions(r.getReponse1(), r.getReponse2()));
  483. reSelectQuestion(nqd.getIntitule());
  484. }
  485. }
  486. else if(e.getSource() == delQ)
  487. {
  488. Question q = (Question) listQ.getSelectedValue();
  489. if(q == null)
  490. {
  491. statusText.setText("Veuiller d'abord selectionner une question.");
  492. return;
  493. }
  494. if(JOptionPane.showConfirmDialog(null, "Voulez vous vraiment supprimer la question " + q.getIntitule() + " ?", "Supression de question", JOptionPane.OK_CANCEL_OPTION) == JOptionPane.OK_OPTION)
  495. {
  496. bdd.deleteQuestion(q.getIntitule(), q.getReponse1(), q.getReponse2());
  497. listQ.setListData(bdd.getListeQuestions(q.getReponse1(), q.getReponse2()).toArray());
  498. }
  499. }
  500. else if(e.getSource() == editQ)
  501. {
  502. Question q = (Question) listQ.getSelectedValue();
  503. if(q == null)
  504. {
  505. statusText.setText("Veuiller d'abord selectionner une question.");
  506. return;
  507. }
  508. NouvelleQuestionDialog nqd = new NouvelleQuestionDialog("Modification question", q.getIntitule(),
  509. q.getReponse(), q.getReponse1(), q.getReponse2(), null);
  510. if(nqd.afficher() == true)
  511. {
  512. bdd.modifyQuestion(q.getIntitule(), nqd.getIntitule(),
  513. q.getReponse1(), q.getReponse2(), nqd.getReponse());
  514. reSelectQuestion(nqd.getIntitule());
  515. }
  516. }
  517. }
  518. }
  519. }