mirror of
https://github.com/DanilaFe/abacus
synced 2024-11-13 14:19:53 -08:00
Add GUI
This commit is contained in:
parent
dd8d62608c
commit
f3f7efdb10
63
src/org/nwapw/abacus/window/Window.java
Normal file
63
src/org/nwapw/abacus/window/Window.java
Normal file
|
@ -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<String> numList = new JComboBox();
|
||||
JComboBox<String> 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);
|
||||
}
|
||||
}
|
24
src/org/nwapw/abacus/window/WindowTest.java
Normal file
24
src/org/nwapw/abacus/window/WindowTest.java
Normal file
|
@ -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);
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user