Started restructuring LogicUI
[Mograsim.git] / LogicUI / src / era / mi / gui / examples / Playground.java
1 package era.mi.gui.examples;
2
3 import era.mi.gui.LogicUICanvas;
4 import era.mi.gui.LogicUIStandalone;
5 import era.mi.gui.model.ViewModel;
6 import era.mi.gui.model.components.GUIAndGate;
7 import era.mi.gui.model.components.GUINotGate;
8
9 public class Playground
10 {
11         private static final int WIRE_DELAY = 10;
12         private static final int OR_DELAY = 50;
13         private static final int NOT_DELAY = 50;
14
15         public static void main(String[] args)
16         {
17                 ViewModel model = new ViewModel();
18                 LogicUIStandalone ui = new LogicUIStandalone(model);
19                 addComponentsAndWires(ui.getLogicUICanvas(), model);
20                 ui.run();
21         }
22
23         public static void addComponentsAndWires(LogicUICanvas ui, ViewModel model)
24         {
25                 GUIAndGate andGate = ui.addComponent(new GUIAndGate(model));
26                 andGate.moveTo(10, 10);
27                 GUINotGate notGate = ui.addComponent(new GUINotGate(model));
28                 notGate.moveTo(10, 40);
29
30                 ui.addWire(andGate.getPins().get(0), notGate.getPins().get(1));
31         }
32 }