-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRobotKarol.java
71 lines (63 loc) · 2.39 KB
/
RobotKarol.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
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import robotkarol.KarolController;
import robotkarol.KarolProgram;
import robotkarol.KarolRoboter;
import robotkarol.KarolView;
import robotkarol.KarolWelt;
public class RobotKarol {
private KarolWelt welt;
private KarolRoboter karol;
private KarolView mainFrame;
private KarolProgram prog;
private KarolController control;
private String programPath = "";
private String fileSeparator = "";
private String homePath = "";
static String propStr = "";
static String progStr = "";
static String weltStr = "";
public RobotKarol() {
this.welt = new KarolWelt(5, 10, 6);
this.karol = new KarolRoboter(this.welt);
this.mainFrame = new KarolView(this.welt);
this.prog = new KarolProgram(this.welt, this.karol, this.mainFrame);
this.control = new KarolController(this.welt, this.karol, this.mainFrame, this.prog);
this.mainFrame.registerListener(this.control);
this.programPath = System.getProperty("user.dir");
this.fileSeparator = System.getProperty("file.separator");
this.homePath = System.getProperty("user.home");
this.welt.setDefaultWeltPfadSep(this.programPath, this.fileSeparator);
this.prog.setDefaultProgPfadSep(this.programPath, this.fileSeparator);
this.mainFrame.setMainPfad(this.programPath, this.fileSeparator);
this.control.startProperties(propStr, progStr, weltStr, this.programPath, this.homePath, this.fileSeparator);
this.mainFrame.pack();
this.mainFrame.setVisible(true);
}
public static void main(String[] args) {
for(String s : args) {
if (!s.isEmpty() && s.startsWith("/I")) {
propStr = s.substring(2, s.length());
}
if (!s.isEmpty() && s.startsWith("/P")) {
progStr = s.substring(2, s.length());
}
if (!s.isEmpty() && s.endsWith(".kdp") && progStr.isEmpty()) {
progStr = s.substring(0, s.length());
}
if (!s.isEmpty() && s.startsWith("/W")) {
weltStr = s.substring(2, s.length());
}
}
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception var2) {
}
new RobotKarol();
}
});
}
}