getSource与getActionCommand的区别
getSource()
Returns:
The object on which the Event initially occurred.
依赖于事件对象
getActionCommand()
Returns the command name of the action event fired by this button. If the command name is null (default) then this method returns the label of the button.
依赖于按钮上的字符串
getSource得到的组件的名称,而getActionCommand得到的是标签。
如:Button bt=new Button("buttons");