1 package era.mi.gui.examples;
3 import org.eclipse.swt.SWT;
5 import era.mi.gui.LogicUIStandalone;
6 import era.mi.gui.model.ViewModel;
7 import era.mi.gui.model.components.GUIAndGate;
8 import era.mi.gui.model.components.GUINotGate;
9 import era.mi.gui.model.wires.GUIWire;
10 import net.haspamelodica.swt.helper.swtobjectwrappers.Point;
12 public class Playground
14 public static void main(String[] args)
16 ViewModel model = new ViewModel();
17 GUIAndGate andGate = new GUIAndGate(model, 1);
18 andGate.moveTo(10, 10);
19 GUINotGate notGate = new GUINotGate(model, 1);
20 notGate.moveTo(10, 40);
22 new GUIWire(model, andGate.getPins().get(0), notGate.getPins().get(1), new Point(20, 50));
24 LogicUIStandalone ui = new LogicUIStandalone(model);
26 ui.getLogicUICanvas().addListener(SWT.KeyDown, e -> notGate.moveTo(150, 10));
30 public static void addComponentsAndWires(LogicUIStandalone ui, ViewModel model)
32 GUIAndGate andGate = new GUIAndGate(model, 1);
33 andGate.moveTo(10, 10);
34 GUINotGate notGate = new GUINotGate(model, 1);
35 notGate.moveTo(10, 40);
37 new GUIWire(model, andGate.getPins().get(0), notGate.getPins().get(1), new Point(20, 50));
39 ui.getLogicUICanvas().addListener(SWT.KeyDown, e -> notGate.moveTo(150, 10));