MCPcopy Create free account
hub / github.com/akeranen/the-one / initGUI

Method initGUI

gui/DTNSimGUI.java:59–94  ·  view source on GitHub ↗

Initializes the GUI

()

Source from the content-addressed store, hash-verified

57 * Initializes the GUI
58 */
59 private void initGUI() {
60 this.field = new PlayField(world, this);
61
62 this.field.addMouseListener(new PlayfieldMouseHandler());
63 this.field.addMouseWheelListener(new PlayfieldMouseHandler());
64
65 this.guiControls = new GUIControls(this,this.field);
66 this.eventLogPanel = new EventLogPanel(this);
67 this.infoPanel = new InfoPanel(this);
68 this.main = new MainWindow(this.scen.getName(), world, field,
69 guiControls, infoPanel, eventLogPanel, this);
70
71 scen.addMessageListener(eventLogPanel);
72 scen.addConnectionListener(eventLogPanel);
73
74 if (scen.getMap() != null ) {
75 field.setMap(scen.getMap());
76 }
77
78 // if user closes the main window, call closeSim()
79 this.main.addWindowListener(new WindowAdapter() {
80 private boolean closeAgain = false;
81 public void windowClosing(WindowEvent e) {
82 closeSim();
83 if (closeAgain) {
84 // if method is called again, force closing
85 System.err.println("Forced close. "+
86 "Some reports may have not been finalized.");
87 System.exit(-1);
88 }
89 closeAgain = true;
90 }
91 });
92
93 this.main.setVisible(true);
94 }
95
96 @Override
97 protected void runSim() {

Callers 1

runMethod · 0.95

Calls 5

getNameMethod · 0.80
addMessageListenerMethod · 0.80
addConnectionListenerMethod · 0.80
getMapMethod · 0.45
setMapMethod · 0.45

Tested by

no test coverage detected