Salut a tous;Je veux faire un programme en java ….
Alors une fenêtre apparaît contient un bouton ’Démarrer’ je veut que lorsque j’appuie sur ce dernier la fenêtre se réduit sous forme d’une icône et lorsque je click deux fois sur l’icône la fenêtre apparaît a nouveau j’ai essaye se code :
lorsque je le compile il m'affiche
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 import java.awt.*; import java.awt.event.*; import javax.swing.*; public class Fenetre { public static void main(String [] args){ JFrame frame=new ServeurFenetre(); frame.show(); } } Class ServeurFenetre extends JFrame { public ServeurFenetre() { ........ Image image=Toolkit.getDefaultToolkit().getImage("F:/tp_reseaux/Serveur/icon.png"); setIconImage(image);.......... b1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { icone(); editeur edit=new editeur(); edit.setVisible(true); } }); ....... } public void icone() { if (SystemTray.isSupported()) { SystemTray tray =SystemTray.getSystemTray(); TrayIcon trayIcon = newTrayIcon(image); ActionListener actionListener = new ActionListener() { public void actionPerformed(ActionEvent e) { ServeurFenetre f=ServeurFenetre(); f.setVisible(true); }}; trayIcon.setImageAutoSize(true); trayIcon.addActionListener(actionListener); try { tray.add(trayIcon); } catch(AWTException e) { e.printStackTrace();} } } }
s'il vous plait aidez-moi je suit un debutant en javaFenetre.java:51: cannot find symbol
symbol : variable SystemTray l
ocation: class ServeurFenetre if (SystemTray.isSupported()) ^
Fenetre.java:52: cannot find symbol
symbol : class SystemTray
location: class ServeurFenetre {SystemTray tray =SystemTray.getSystemTray(); ^
Fenetre.java:52: cannot find symbol
symbol : variable SystemTray
location: class ServeurFenetre {SystemTray tray =SystemTray.getSystemTray(); ^
Fenetre.java:53: cannot find symbol
symbol : class TrayIcon location: class ServeurFenetre TrayIcon trayIcon = newTrayIcon(image); ^ Fenetre.java:53: cannot find symbol
symbol : variable image
location: class ServeurFenetre TrayIcon trayIcon = newTrayIcon(image); ^ Note: Fenetre.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. 5 errors
Partager