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 private static final int WIRE_DELAY = 10;
15 private static final int OR_DELAY = 50;
16 private static final int NOT_DELAY = 50;
18 public static void main(String[] args)
20 ViewModel model = new ViewModel();
21 LogicUIStandalone ui = new LogicUIStandalone(model);
22 addComponentsAndWires(ui, model);
26 public static void addComponentsAndWires(LogicUIStandalone ui, ViewModel model)
28 GUIAndGate andGate = new GUIAndGate(model);
29 andGate.moveTo(10, 10);
30 GUINotGate notGate = new GUINotGate(model);
31 notGate.moveTo(10, 40);
33 new GUIWire(model, andGate.getPins().get(0), notGate.getPins().get(1), new Point(20, 50));
35 ui.getLogicUICanvas().addListener(SWT.KeyDown, e -> notGate.moveTo(150, 10));