按钮的actionEvent中有好多操作.不想用同样的代码写2次.
比如
public void actionPerformed(ActionEvent event) {
s = event.getActionCommand();
if (s == "0")
textField.setText(textField.getText() + s);
}
在KeyListener中怎样实现同样的操作?
比如
public void actionPerformed(ActionEvent event) {
s = event.getActionCommand();
if (s == "0")
textField.setText(textField.getText() + s);
}
在KeyListener中怎样实现同样的操作?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货