diff --git a/src/Main.java b/src/Main.java index c42e6cd..fa99761 100644 --- a/src/Main.java +++ b/src/Main.java @@ -4,6 +4,11 @@ private ScreenTemplates screenTemplates; private Screen screen; private CurScreen curScreen; + + public static void main(String[] args) { + Main main = new Main(); + SimpleUIWindow window = new SimpleUIWindow(main); + } public Main() { this.screenTemplates = new ScreenTemplates(curScreen); this.curScreen = new CurScreen(screen, screenTemplates); diff --git a/src/SimpleUIWindow.java b/src/SimpleUIWindow.java new file mode 100644 index 0000000..4910354 --- /dev/null +++ b/src/SimpleUIWindow.java @@ -0,0 +1,11 @@ +import javax.swing.*; + +public class SimpleUIWindow extends JFrame { + private Main main; + + public SimpleUIWindow(Main main) { + this.main = main; + setSize(870, 640); + setVisible(true); + } +} diff --git a/src/Widgets1.java b/src/Widgets1.java index 82e71a0..4fca8a4 100644 --- a/src/Widgets1.java +++ b/src/Widgets1.java @@ -8,13 +8,20 @@ } public void setValue(Map value) { for (String key: value.keySet()) { - int y = (int) ((Map) value.get(key)).get("y"); - int x = (int) ((Map) value.get(key)).get("x"); - int height = (int) ((Map) value.get(key)).get("height"); - String text = (String) ((Map) value.get(key)).get("text"); - boolean visible = (boolean) ((Map) value.get(key)).get("visible"); - int width = (int) ((Map) value.get(key)).get("width"); - int state = (int) ((Map) value.get(key)).get("state"); + int y = 0; + if (((Map) value.get(key)).get("y") != null) y = (int) ((Map) value.get(key)).get("y"); + int x = 0; + if (((Map) value.get(key)).get("x") != null) x = (int) ((Map) value.get(key)).get("x"); + int height = 0; + if (((Map) value.get(key)).get("height") != null) height = (int) ((Map) value.get(key)).get("height"); + String text = ""; + if (((Map) value.get(key)).get("text") != null) text = (String) ((Map) value.get(key)).get("text"); + boolean visible = false; + if (((Map) value.get(key)).get("visible") != null) visible = (boolean) ((Map) value.get(key)).get("visible"); + int width = 0; + if (((Map) value.get(key)).get("width") != null) width = (int) ((Map) value.get(key)).get("width"); + int state = 0; + if (((Map) value.get(key)).get("state") != null) state = (int) ((Map) value.get(key)).get("state"); this.value.put(key, new Widget1(true, width, x, y, text, 0, height, curScreen)); } }