afficher une image au click
Bonjour, je souhaite ajouter dans mon application un gif en guise de barre de progression infini afin d'avertir l'utilisateur que l'appli n'est pas bugé ;)
Voila comment est organisé mon code :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
public void AjoutComposant(final Container pane) throws FileNotFoundException, IOException {
final GridBagConstraints c = new GridBagConstraints();
if (shouldFill) {
c.fill = GridBagConstraints.HORIZONTAL;
}
image.hide();
c.gridx = 2;
c.gridy =0;
c.ipady = 10;
c.weightx = 0.0;
c.gridwidth = 3;
c.insets.top=5;
pane.add(image, c);
c.gridx = 3;
c.gridy = 4;
c.ipadx=0;
c.ipady = 0;
c.gridwidth = 1;
c.insets.left=10;
c.insets.right=5;
c.insets.bottom=90;
pane.add(boutonOpen, c);
c.ipady = 40;
c.weightx = 0.0;
c.gridwidth = 3;
c.gridx = 2;
c.gridy = 5;
c.insets.left=100;
c.insets.right=100;
c.insets.bottom=20;
c.insets.top=20;
pane.add(boutonConfirm, c);
........... |
L'action listener sur le bouton permettant de lancer l'application :
Code:
1 2 3 4 5 6 7 8 9 10 11 12
| boutonConfirm.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent ev){
if (selectionFichier==null || selectionFichier.length==0)
JOptionPane.showMessageDialog(boutonConfirm, "Veuillez choisir au moins un fichier");
else {
TraitementXml.process(selectionFichier);
JOptionPane.showMessageDialog(pane,"Traitement Terminé","Information",JOptionPane.INFORMATION_MESSAGE);
}
}
}); |
J'ai donc caché pour l'instant l'image mais ne vois pas comment la faire apparaitre (ce que je dois ajouter dans l'action listener).
Merci beaucoup d'avance!