getSourse() 与getActionCommand 区别

来源:互联网 发布:詹姆斯沃西数据 编辑:程序博客网 时间:2024/05/18 02:58
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");      用getSource得到的是bt 而用getActionCommand得到的是:buttons
0 0
原创粉丝点击