事件处理中
Object getSource() return the object that fired the event,而getComponent 会返回一个component
这个object和component 有什么区别,不都是触发监听者的吗?具体起来就不知道各指的是什么。
Object getSource() return the object that fired the event,而getComponent 会返回一个component
这个object和component 有什么区别,不都是触发监听者的吗?具体起来就不知道各指的是什么。
getSource是返回触发此事件的对象,由于不清楚它的具体形别,所以才用object来定义但getComponent是返回构件,已经指定了返回类型,比object更窄。它的作用是返回此container中第几个componet,并不是返回触发此事件的对象