-
Notifications
You must be signed in to change notification settings - Fork 0
/
DesktopTaskbar.java
145 lines (131 loc) · 3 KB
/
DesktopTaskbar.java
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
import java.awt.*;
import javax.swing.*;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
class DesktopTaskbar extends Thread implements MouseListener
{
String b ,name[];
JPanel desktopitem;
DesktopTaskbar(String b)
{
this.b= b;
//Desktop.jpMainDesktop.revalidate();
//Desktop.jpMainDesktop.repaint();
}
public void run()
{
name = b.split("\\.");
desktopitem = new JPanel(new FlowLayout(FlowLayout.LEFT));
desktopitem.setOpaque(false);
desktopitem.setBackground(new Color(0,0,0,0));
JLabel jl1 = new JLabel("", new ImageIcon(b), JLabel.CENTER);
desktopitem.add(jl1);
desktopitem.addMouseListener(this);
Desktop.jpos2.add(desktopitem);
}
public void mousePressed(MouseEvent e){}
public void mouseReleased(MouseEvent e){}
public void mouseEntered(MouseEvent e)
{
//System.out.println("Mouse Entered");
desktopitem.setOpaque(true);
desktopitem.setBackground(new Color(89,180,255));
}
public void mouseExited(MouseEvent e)
{
desktopitem.setOpaque(false);
desktopitem.setBackground(new Color(0,0,0,0));
}
public void mouseClicked(MouseEvent e)
{
Runtime rs = Runtime.getRuntime();
System.out.println("Mouse clicked");
if(name[0].equals("Start Button_"))
{
try
{
if(WindowMenu.flag==1 )
{
WindowMenu.jw1.setVisible(false);
WindowMenu.flag=0;
}
else
{
new WindowMenu();
}
}
catch(Exception e11){}
}
else
{
if(WindowMenu.flag==1 )
{
WindowMenu.jw1.setVisible(false);
WindowMenu.flag=0;
}
}
if (name[0].equals("Internet Explorer_40x40"))
{
try
{
rs.exec("cmd /c start http://google.com/");
}
catch(Exception e11){System.out.println(e11);}
}
else if (name[0].equals("windows media player_40x40"))
{
try
{
rs.exec("c:\\Program Files\\Windows Media Player\\wmplayer.exe");
}
catch(Exception e11){System.out.println(e11);}
}
else if (name[0].equals("notepad_40x40"))
{
try
{
rs.exec("notepad");
}
catch(Exception e11){System.out.println(e11);}
}
else if (name[0].equals("disk_50x50"))
{
try
{
rs.exec("explorer /root,");
}
catch(Exception e11){System.out.println(e11);}
}
else if (name[0].equals("volume_"))
{
try
{
rs.exec("sndvol");
}
catch(Exception e11){System.out.println(e11);}
}
else if (name[0].equals("switchoff _40x40"))
{
try
{
//rs.exec("shutdown -s");
//rs,exec("shutdown -a"); try it
//rs.exec("shutdown -m");
System.exit(0);
}
catch(Exception e11){System.out.println(e11);}
}
else if (name[0].equals("Task Manager_"))
{
try
{
//rs.exec("shutdown -s");
rs.exec("taskmgr");
}
catch(Exception e11){System.out.println(e11);}
}
}
}