From f3f7efdb108c01072a2c876a120baff330ede8c7 Mon Sep 17 00:00:00 2001 From: rileyJones Date: Tue, 25 Jul 2017 14:52:57 -0700 Subject: [PATCH] Add GUI --- src/org/nwapw/abacus/window/Window.java | 63 +++++++++++++++++++++ src/org/nwapw/abacus/window/WindowTest.java | 24 ++++++++ 2 files changed, 87 insertions(+) create mode 100644 src/org/nwapw/abacus/window/Window.java create mode 100644 src/org/nwapw/abacus/window/WindowTest.java diff --git a/src/org/nwapw/abacus/window/Window.java b/src/org/nwapw/abacus/window/Window.java new file mode 100644 index 0000000..5413d07 --- /dev/null +++ b/src/org/nwapw/abacus/window/Window.java @@ -0,0 +1,63 @@ +package org.nwapw.abacus.window; + +import javax.swing.*; +import java.awt.*; + +public class Window extends JFrame { + private String history; + private String lastOutput; + public Window(){ + super(); + try { + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + } catch (ClassNotFoundException e) { + e.printStackTrace(); + } catch (InstantiationException e) { + e.printStackTrace(); + } catch (IllegalAccessException e) { + e.printStackTrace(); + } catch (UnsupportedLookAndFeelException e) { + e.printStackTrace(); + } + + //JFrame super= new JFrame(); + //ImageIcon check = new ImageIcon(".\\Window Images\\Untitled.png"); + String check = "Enter"; + JButton checkButton = new JButton(check); + JTextField inputBox = new JTextField(); + history=""; + JTextArea historyBox = new JTextArea(history); + JScrollPane scrollHistoryBox = new JScrollPane(historyBox); + JTextArea outputBox = new JTextArea(lastOutput); + JPanel output=new JPanel(); + output.setLayout(new BorderLayout()); + output.add(scrollHistoryBox); + output.add(outputBox, BorderLayout.PAGE_END); + JPanel input = new JPanel(); + input.setLayout(new BorderLayout()); + input.add(inputBox); + input.add(checkButton, BorderLayout.LINE_END); + super.add(output); + JPanel custom = new JPanel(); + JPanel numCustom = new JPanel(); + JPanel funCustom = new JPanel(); + custom.setLayout(new BorderLayout()); + numCustom.setLayout(new BorderLayout()); + funCustom.setLayout(new BorderLayout()); + JTextArea numLabel = new JTextArea("Number Type:"); + JTextArea funLabel = new JTextArea("Functions:"); + JComboBox numList = new JComboBox(); + JComboBox funList = new JComboBox(); + JButton funCheckButton = new JButton(check); + numCustom.add(numLabel); + numCustom.add(numList, BorderLayout.PAGE_END); + funCustom.add(funList); + funCustom.add(funCheckButton, BorderLayout.LINE_END); + funCustom.add(funLabel, BorderLayout.PAGE_START); + custom.add(numCustom); + custom.add(funCustom, BorderLayout.PAGE_END); + super.add(custom, BorderLayout.LINE_END); + super.add(input, BorderLayout.PAGE_END); + super.setVisible(true); + } +} diff --git a/src/org/nwapw/abacus/window/WindowTest.java b/src/org/nwapw/abacus/window/WindowTest.java new file mode 100644 index 0000000..377308c --- /dev/null +++ b/src/org/nwapw/abacus/window/WindowTest.java @@ -0,0 +1,24 @@ +package org.nwapw.abacus.window; + +import javax.swing.*; +import java.awt.Color; +import java.awt.Frame; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.BorderLayout; +import java.util.Arrays; +public class WindowTest { + public static void main(String[] args){ + + + + + + + + + + new Window().setVisible(true); + + } +}