-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProcessExplorerApp.java
More file actions
78 lines (69 loc) · 2.1 KB
/
ProcessExplorerApp.java
File metadata and controls
78 lines (69 loc) · 2.1 KB
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
package net.ddns.x444556;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.event.KeyEvent;
public class ProcessExplorerApp extends Application {
private Window ui;
private Program javaos;
private int scrollPosition = 0;
public ProcessExplorerApp(Program javaos) {
super(javaos);
this.javaos = javaos;
Name = "ProcessExplorer";
}
@Override
public void paintWindow(Window w, Graphics g) {
if(w != ui) return;
g.setColor(new Color(90, 90, 90));
g.fillRect(0, 0, ui.getWidth(), ui.getHeight());
g.setColor(new Color(30, 30, 30));
g.drawString("Total Applications", 10, 14);
g.drawString("Total Windows", 10, 26);
g.drawString(Integer.toString(javaos.RunningApps.size()), 128, 14);
g.drawString(Integer.toString(javaos.Windows.size()), 128, 26);
for(int i=0; i+scrollPosition<javaos.RunningApps.size() && i<(ui.getHeight() - 64)/12; i++) {
Application a = javaos.RunningApps.get(i+scrollPosition);
g.drawString(a.Name, 10, 64 + i*12);
g.drawString(Long.toString(a.PID), 180, 64 + i*12);
g.drawString(Integer.toString(a.Windows.size()), 200, 64 + i*12);
}
}
@Override
public Application CreateNew() {
return new ProcessExplorerApp(javaos);
}
@Override
public void Start() {
ui = new Window(230, 300, javaos.randomInt(0, javaos.getWidth() - 230),
javaos.randomInt(0, javaos.getHeight() - 490), "Process Explorer");
AddWindow(ui);
while(!ui.isAdded)
try {
Thread.sleep(10);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
ui.Focus();
ui.UnFocus();
javaos.sortWindows();
}
@Override
public void Close(Window w) {
if(w == ui) this.Exit();
else {
javaos.RemoveWindow(w);
Windows.remove(w);
}
}
@Override
public void keyReleased(KeyEvent e, Window w) {
if(w != ui) return;
if(e.getKeyCode() == KeyEvent.VK_DOWN && scrollPosition < javaos.RunningApps.size() - 1) {
scrollPosition++;
}
else if(e.getKeyCode() == KeyEvent.VK_UP && scrollPosition > 0) {
scrollPosition--;
}
}
}