diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..359bb53
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,3 @@
+# 默认忽略的文件
+/shelf/
+/workspace.xml
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..0548357
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..a75e6a5
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..35eb1dd
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Calculator.java b/Calculator.java
index 1b4a65a..c121c36 100644
--- a/Calculator.java
+++ b/Calculator.java
@@ -5,11 +5,9 @@ import java.awt.event.ActionListener;
import javax.script.ScriptEngineManager;
import javax.script.ScriptEngine;
import javax.script.ScriptException;
-
public class Calculator extends JFrame implements ActionListener {
private JTextField display;
private StringBuilder input;
-
public Calculator() {
input = new StringBuilder();
display = new JTextField();
@@ -20,7 +18,6 @@ public class Calculator extends JFrame implements ActionListener {
JPanel panel = new JPanel();
panel.setLayout(new GridLayout(4, 4, 10, 10));
panel.setBackground(Color.GRAY);
-
String[] buttons = {
"7", "8", "9", "/",
"4", "5", "6", "*",
@@ -36,7 +33,6 @@ public class Calculator extends JFrame implements ActionListener {
}
add(display, BorderLayout.NORTH);
add(panel, BorderLayout.CENTER);
-
setTitle("Calculator");
setSize(400, 500);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
@@ -62,12 +58,10 @@ public class Calculator extends JFrame implements ActionListener {
display.setText(input.toString());
}
}
-
private double evaluate(String expression) throws ScriptException {
ScriptEngine engine = new ScriptEngineManager().getEngineByName("JavaScript");
return ((Number) engine.eval(expression)).doubleValue();
}
-//11122222
public static void main(String[] args) {
SwingUtilities.invokeLater(() -> {
Calculator calculator = new Calculator();
diff --git a/lesson2.iml b/lesson2.iml
new file mode 100644
index 0000000..b107a2d
--- /dev/null
+++ b/lesson2.iml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file