设置此组件激发的操作事件的命令名称。 如:
JButton btnShow = new JButton();
btnShow.setActionCommand("show");
当这个按钮被点击的时候,你就可以用
ActionEvent 的 getActionCommand().equals("show")
去比较触发事件的是不是这个按钮。在j2me中经常用到这样的方法。
JButton btnShow = new JButton();
btnShow.setActionCommand("show");
当这个按钮被点击的时候,你就可以用
ActionEvent 的 getActionCommand().equals("show")
去比较触发事件的是不是这个按钮。在j2me中经常用到这样的方法。