-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScreens.java
More file actions
68 lines (55 loc) · 2.39 KB
/
Screens.java
File metadata and controls
68 lines (55 loc) · 2.39 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
import java.awt.FlowLayout;
import javax.swing.JSplitPane;
public class Screens {
public static DataFrame dataFrame = new DataFrame();
public static BrainPanel brainPanel;
public static GUIPanel guiPanel;
public static SimulationPanel simulationPanel;
public static MenuPanel menuPanel;
public static JSplitPane simulationSplitPane;
public static Translation brainWorldToScreen;
public static SimulationFrame simulationFrame = new SimulationFrame();
public static Translation SimulationWorldToScreen;
public static String[] creatureNames;
public static void createScreens() {
brainWorldToScreen = new Translation(Main.loaded.brainScreenSizeX, Main.loaded.brainScreenSizeY);
SimulationWorldToScreen = new Translation(Main.loaded.worldSize, Main.loaded.worldSize);
creatureNames = new String[Main.loaded.creaturesList.length+1];
creatureNames[0] = "None Selected";
for(int i=1; i<creatureNames.length; i++){
creatureNames[i] = String.format("Creature %04d",i);
}
brainPanel = new BrainPanel();
guiPanel = new GUIPanel();
simulationPanel = new SimulationPanel();
menuPanel = new MenuPanel();
// Brain Frame
brainPanel.setLayout(new FlowLayout(FlowLayout.LEADING));
dataFrame.add(brainPanel);
dataFrame.setVisible(true);
for(int i=0; i<Main.loaded.creaturesList.length; i++){
creatureNames[i] = String.format("Creature %04d",i);
}
// Simulation Frame
simulationSplitPane = new JSplitPane();
simulationSplitPane.setOrientation(JSplitPane.HORIZONTAL_SPLIT);
simulationSplitPane.setDividerLocation(1000);
simulationSplitPane.setDividerSize(0);
simulationSplitPane.setLeftComponent(simulationPanel);
simulationSplitPane.setRightComponent(guiPanel);
simulationFrame.add(menuPanel);
simulationFrame.setVisible(true);
Main.loaded.visualPanel = simulationPanel;
}
public static void setContent(String type) {
if(type.equals("Simulation")){
simulationFrame.remove(menuPanel);
simulationFrame.add(simulationSplitPane);
}
else{
simulationFrame.remove(simulationSplitPane);
simulationFrame.add(menuPanel);
}
simulationFrame.setVisible(true);
}
}