1 Star 0 Fork 0

赏镜猎人/swing-calc

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
OperationListener.java 1.20 KB
一键复制 编辑 原始数据 按行查看 历史
赏镜猎人 提交于 2021-07-02 02:00 . Init.
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();
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/bouncy-hunter/swing-calc.git
[email protected]:bouncy-hunter/swing-calc.git
bouncy-hunter
swing-calc
swing-calc
master

搜索帮助