代码拉取完成,页面将自动刷新
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class OperationListener implements ActionListener {
Register register;
AnswerLabel answer;
char sign;
void setRegister(Register r)
{
register = r;
}
Register getRegister() {
return register;
}
void setAnswer(AnswerLabel a) {
answer = a;
}
AnswerLabel getAnswer() {
return answer;
}
void setSign(char c) {
sign = c;
}
char getSign() {
return sign;
}
public OperationListener(Register r, AnswerLabel a, char c)
{
setRegister(r);
setAnswer(a);
setSign(c);
}
@Override
public void actionPerformed(ActionEvent e) {
if(answer.getStatus() != AnswerLabel.ABORT) {
if (register.getOperation() != '\0') register.calculate(Double.parseDouble(answer.getText()));
else register.setRes(Double.parseDouble(answer.getText()));
answer.loadDouble(register.getRes());
answer.setStatus(AnswerLabel.ABORT);
}
register.setOperation(sign);
register.updateText();
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。