diff --git a/src/main/java/dev/sillyangel/calc/Calculator.java b/src/main/java/dev/sillyangel/calc/Calculator.java index 7ad8b46..d58f97c 100644 --- a/src/main/java/dev/sillyangel/calc/Calculator.java +++ b/src/main/java/dev/sillyangel/calc/Calculator.java @@ -37,15 +37,13 @@ public class Calculator extends JFrame implements KeyListener { private static final String PREF_ALWAYS_ON_TOP = "alwaysOnTop"; public static final Preferences prefs = Preferences.userRoot().node(PREF_NODE_NAME); public static String APPLICATION_VERSION = "1.0.0pre"; - private JPanel contentPane; - private JTextField display; + private JTextField display; private String operand1; private String operator; private String operand2; protected boolean resultVisible; protected double result; - private JComboBox modeselect; - private final CalculatorHistory history; + private final CalculatorHistory history; private final List undoStack = new ArrayList<>(); private int undoIndex = -1; @@ -113,11 +111,12 @@ public class Calculator extends JFrame implements KeyListener { setFocusable(true); addKeyListener(this); - contentPane = new JPanel(); + JPanel contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); display = new JTextField(); + display.setFocusable(false); display.setEditable(false); display.setFont(new Font("Segoe UI", Font.PLAIN, 22)); display.setColumns(10); @@ -194,7 +193,12 @@ public class Calculator extends JFrame implements KeyListener { JMenuItem preferencesm = new JMenuItem("Preferences"); preferencesm.setMnemonic('P'); preferencesm.addActionListener(e -> PreferencesAction()); - + undo.addActionListener(e -> undoAction()); + redo.addActionListener(e -> redoAction()); + cut.addActionListener(e -> cutAction()); + copy.addActionListener(e -> copyAction()); + paste.addActionListener(e -> pasteAction()); + edit.add(undo); edit.add(redo); edit.add(cut); @@ -214,7 +218,7 @@ public class Calculator extends JFrame implements KeyListener { setJMenuBar(menubar); String[] modes = new String[]{"Standard", "Scientific", "Data calculation"}; - modeselect = new JComboBox<>(modes); + JComboBox modeselect = new JComboBox<>(modes); modeselect.addActionListener(new ActionListener() { @SuppressWarnings("unchecked") public void actionPerformed(ActionEvent e) {