This commit is contained in:
@@ -37,14 +37,12 @@ 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 String operand1;
|
||||
private String operator;
|
||||
private String operand2;
|
||||
protected boolean resultVisible;
|
||||
protected double result;
|
||||
private JComboBox<String> modeselect;
|
||||
private final CalculatorHistory history;
|
||||
private final List<String> 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,6 +193,11 @@ 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);
|
||||
@@ -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<String> modeselect = new JComboBox<>(modes);
|
||||
modeselect.addActionListener(new ActionListener() {
|
||||
@SuppressWarnings("unchecked")
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
|
||||
Reference in New Issue
Block a user