Bonjour, Je ne sais pas si c'est ici la bonne place pour poster mais bon... J'aimerais avoir de l'aide avec ce probleme ci-dessous
Je cherche a faire un boutton, que quand on clique dessus, sa va ouvrir un site internet quelconque. Jaimerais avoir de l'aide et si quelqu'un Peux, M'envoyer le bon code Qui Marche
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 import javax.swing.*; import java.awt.*; import java.awt.event.ActionListener; public class GUI extends JFrame implements ActionListener { public GUI(){ // Title And Side super("Legendz-Scape Menu"); setSize(75, 300); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); FlowLayout flow = new FlowLayout(); setLayout(flow); // Download Button JButton ClientButton = new JButton("Download Client"); add(ClientButton); setVisible(true); // Forum Button JButton ForumButton = new JButton("Forum"); add(ForumButton); setVisible(true); Forummenu.setActionCommand("Forum"); } public static void main(String[] args){ GUI frame = new GUI(); } public void actionPerformed(ActionEvent evt) { String actionCommand = evt.getActionCommand(); if (actionCommand != null) { if (cmd.equalsIgnoreCase("Forum")) { String url = "http://www.moparscape.org/serverstatus.php"; String browserPath = "http://www.moparscape.org/serverstatus.php"; browserPath = "C:/Program Files/Internet Explorer/iexplore.exe"; url = "http://www.moparscape.org/serverstatus.php"; try { String[] b = {browserPath, url}; Runtime.getRuntime().exec(b); } catch (Exception exc) { exc.printStackTrace(); } } } }
Erreur : ( cliquer sur l'image pour voir en plus gros )
Partager