@Override
 public void actionPerformed(ActionEvent arg0) {
   String text = textArea.getText();
   // on n'envoie pas de commentaire vide
   if (text.equals("")) {
     JOptionPane.showMessageDialog(
         null,
         Messages.getMessage("emptyCommentError"),
         Messages.getMessage("error"),
         JOptionPane.ERROR_MESSAGE);
   } else {
     boolean reussite = true;
     try {
       reussite =
           CommentService.getInstance().creer(text, this.imageId, Main.sessionManager.getLogin());
     } catch (IOException e) {
       reussite = false;
       LOG.error(Outil.getStackTrace(e));
     }
     if (reussite) {
       rafraichir();
     } else {
       JOptionPane.showMessageDialog(
           null,
           Messages.getMessage("addCommentError"),
           Messages.getMessage("error"),
           JOptionPane.ERROR_MESSAGE);
     }
   }
 }
 private void rafraichir() {
   this.getContentPane().removeAll();
   try {
     List<Comment> commentsForImage = CommentService.getInstance().lister(imageId);
     GridBagConstraints c = new GridBagConstraints();
     c.insets = new Insets(3, 3, 3, 3);
     c.gridx = 0;
     c.gridy = 0;
     // boucle sur tous les commentaires
     for (Comment comment : commentsForImage) {
       CommentPanel panel;
       if (alternate) {
         panel =
             new CommentPanel(
                 new Color(153, 204, 51),
                 comment.getContent(),
                 comment.getAuthor(),
                 comment.getDate());
       } else {
         panel =
             new CommentPanel(
                 new Color(77, 204, 51),
                 comment.getContent(),
                 comment.getAuthor(),
                 comment.getDate());
       }
       alternate = !alternate;
       panelScrollCommentaires.add(panel, c);
       c.gridy++;
     }
   } catch (Exception e) {
     LOG.error(Outil.getStackTrace(e));
     JOptionPane.showMessageDialog(
         null,
         Messages.getMessage("commentListingError"),
         Messages.getMessage("error"),
         JOptionPane.ERROR_MESSAGE);
   }
   panelAjouterCommentaire.add(scrollPaneArea);
   boutonEnvoyer.addActionListener(this);
   panelAjouterCommentaire.add(boutonEnvoyer);
   this.getContentPane().setLayout(new BorderLayout());
   this.getContentPane().add(scrollPaneCommentaires, BorderLayout.NORTH);
   this.getContentPane().add(panelAjouterCommentaire, BorderLayout.CENTER);
   this.getContentPane().repaint();
   ((JPanel) this.getContentPane()).revalidate();
 }