Bonjour a tous,

j'ai un petit soucis avec une JDialog.
Cette JDialog est une BorderLayout.
Au north et au centre, j'ai deux JLabel.

En South, j'ai un JButton "cacher" qui permet de faire un lien HTTP.
Le problème est que dès que je passe sur ce JButton, le centre et le north disparaisse...

Donc voici mon code:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
package interfaceGraphique;
 
import java.awt.BorderLayout;
import java.awt.Cursor;
import java.awt.Desktop;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
 
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;
 
public class FenetreAbout  extends JDialog{
 
	/**
         * Nombre utile en cas de sérialisation
         */
	private static final long serialVersionUID = -7452839498829858030L;
 
	public FenetreAbout (Interface inter){
		super(inter, "A propos", true);
		setLayout(new BorderLayout());
 
		Icon jcompta = new ImageIcon(getClass().getResource("/ressources/statJour.png"));
		String sNom="<html><body><b>JCompta</b> by Hannibal</body></html>";
		JLabel nom=new JLabel(sNom);
		nom.setHorizontalAlignment(JLabel.CENTER);
		nom.setIcon(jcompta);
 
		add(nom,BorderLayout.NORTH);
 
		String sVersion="<html><body>Version 1.0 -- Juin 2011</body></html>";
		JLabel version=new JLabel(sVersion);
		version.setHorizontalAlignment(JLabel.CENTER);
		add(version);
 
		Icon gpl = new ImageIcon(getClass().getResource("/ressources/gpl.png"));
		String sLicence="<html><body>Logiciel sous licence GPL V3</body></html>";
 
		JButton licence=new JButton(sLicence);
		licence.setIcon(gpl);
		licence.setCursor(new Cursor(Cursor.HAND_CURSOR));
		licence.addActionListener(new EcouteurLien());
		licence.setBorderPainted(false);
		licence.setContentAreaFilled(false);
		add(licence,BorderLayout.SOUTH);
 
		pack();
		setSize(this.getWidth()+10,this.getHeight()+10);
		setResizable(false);
		setDefaultCloseOperation(DISPOSE_ON_CLOSE);
		setLocationRelativeTo(null);
		setVisible(true);
	}
 
	/**
         * Classe permettant de gerer l'ouverture du lien
         * http lors du clique sur le JButton licence
         * @author hannibal
         *
         */
	private class EcouteurLien implements ActionListener{
 
		@Override
		public void actionPerformed(ActionEvent e) {
 
			// On vérifie que la classe Desktop soit bien supportée :
			if ( Desktop.isDesktopSupported() ) {
 
				// On récupère l'instance du desktop :
				Desktop desktop = Desktop.getDesktop();
 
				// On vérifie que la fonction browse est bien supportée :
				if (desktop.isSupported(Desktop.Action.BROWSE)) {
 
					// Et on lance l'application associé au protocole :
					try {
						desktop.browse(new URI("http://www.gnu.org/licenses/gpl.html"));
					} catch (IOException e1) {
						// TODO Auto-generated catch block
						e1.printStackTrace();
					} catch (URISyntaxException e1) {
						// TODO Auto-generated catch block
						e1.printStackTrace();
					}
				}
			}
		}
 
	}
 
}

Voila voila, donc si vous avez une idée
Merci d'avance