Skip to content

Commit 63f09de

Browse files
committed
.
1 parent 29bd45c commit 63f09de

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

Lesson01/src/com/eomjinyoung/lesson01/exam02/client/CalculatorFrame.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,8 @@
1717
public class CalculatorFrame extends JFrame implements ActionListener{
1818
CalculatorAgent calcAgent = new CalculatorAgent("localhost", 8888);
1919
JTextField operand1 = new JTextField(4);
20+
JTextField operator = new JTextField(2);
2021
JTextField operand2 = new JTextField(4);
21-
String[] operatorData = {"+", "-", "*", "/"};
22-
JComboBox<String> operator = new JComboBox<String>(operatorData);
2322
JButton equal = new JButton("=");
2423
JTextField result = new JTextField(6);
2524
JButton clear = new JButton("Clear");
@@ -55,7 +54,7 @@ private void compute() {
5554
double r = 0;
5655

5756
try {
58-
r = calcAgent.compute(operator.getSelectedItem().toString(), a, b);
57+
r = calcAgent.compute(operator.getText(), a, b);
5958
result.setText(Double.toString(r));
6059

6160
} catch (Exception err) {

0 commit comments

Comments
 (0)