diff --git a/src/main/java/ic/doc/RpnCalculator.java b/src/main/java/ic/doc/RpnCalculator.java new file mode 100644 index 0000000..0ff0187 --- /dev/null +++ b/src/main/java/ic/doc/RpnCalculator.java @@ -0,0 +1,12 @@ +package ic.doc; + +public class RpnCalculator { + private static final int DEFAULT_WIDTH = 400; + private static final int DEFAULT_HEIGHT = 400; + + public static void main(String[] args) { + RpnCalculatorGui calculatorGui = RpnCalculatorGui.withDimensions(DEFAULT_WIDTH, DEFAULT_HEIGHT); + + calculatorGui.display(); + } +} diff --git a/src/main/java/ic/doc/RpnCalculatorGui.java b/src/main/java/ic/doc/RpnCalculatorGui.java new file mode 100644 index 0000000..9310481 --- /dev/null +++ b/src/main/java/ic/doc/RpnCalculatorGui.java @@ -0,0 +1,34 @@ +package ic.doc; + +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.JTextField; + +public class RpnCalculatorGui { + private final int defaultWidth; + private final int defaultHeight; + + private static final int RESULT_FIELD_WIDTH = 10; + + public static RpnCalculatorGui withDimensions(int defaultWidth, int defaultHeight) { + return new RpnCalculatorGui(defaultWidth, defaultHeight); + } + + private RpnCalculatorGui(int defaultWidth, int defaultHeight) { + this.defaultWidth = defaultWidth; + this.defaultHeight = defaultHeight; + } + + public void display() { + JFrame frame = new JFrame("RPN Calculator"); + frame.setSize(defaultWidth, defaultHeight); + + JPanel panel = new JPanel(); + + JTextField resultField = new JTextField(RESULT_FIELD_WIDTH); + panel.add(resultField); + + frame.add(panel); + frame.setVisible(true); + } +}