File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import java .awt .*;
12import java .io .IOException ;
23import java .net .URISyntaxException ;
34
45public class Main {
5- public static void main (String [] args ) throws IOException , URISyntaxException {
6+ public static void main (String [] args ) throws IOException , URISyntaxException , AWTException {
67
78 }
89}
Original file line number Diff line number Diff line change 1+ package swing .awt ;
2+
3+ import javax .swing .*;
4+ import java .awt .*;
5+ import java .io .IOException ;
6+ import java .net .URISyntaxException ;
7+
8+ public class SystemTrayLesson {
9+ public static void main (String [] args ) throws IOException , URISyntaxException , AWTException {
10+ if (SystemTray .isSupported ()) {
11+ SystemTray tray = SystemTray .getSystemTray ();
12+ Image image = new ImageIcon ("/home/max/IdeaProjects/JavaLessons/icon.jpg" , "descr" ).getImage ();
13+ PopupMenu menu = new PopupMenu ();
14+ menu .add (new MenuItem ("one" ));
15+ menu .add (new MenuItem ("two" ));
16+ tray .add (new TrayIcon (image , "description" , menu ));
17+ }
18+ }
19+ }
You can’t perform that action at this time.
0 commit comments