我用Java做了一个计算器,但是有些代码非常重复。这是我用来添加 ActionListener 的内容
one.addActionListener(handlerOne);
two.addActionListener(handlerOne);
three.addActionListener(handlerOne);
four.addActionListener(handlerOne);
five.addActionListener(handlerOne);
six.addActionListener(handlerOne);
seven.addActionListener(handlerOne);
eight.addActionListener(handlerOne);
nine.addActionListener(handlerOne);
zero.addActionListener(handlerOne);
add.addActionListener(handlerOne);
subtract.addActionListener(handlerOne);
multiply.addActionListener(handlerOne);
divide.addActionListener(handlerOne);
sqrt.addActionListener(handlerOne);
exp.addActionListener(handlerOne);
equals.addActionListener(handlerOne);
cls.addActionListener(handlerOne);
modulus.addActionListener(handlerOne);
有什么办法可以缩短这个吗?