如果我有 5 个具有相同鼠标适配器的 JPanel,并且我想确定单击了哪个面板,我该怎么做?
最佳答案
MouseEvent
是 ComponentEvent
的子类,因此:
http://download.oracle.com/javase/6/docs/api/java/awt/event/ComponentEvent.html#getComponent%28%29
getComponent
public Component getComponent()
Returns the originator of the event.
Returns: the Component object that originated the event, or null if the object is not a Component.
关于java - 有没有办法为添加了鼠标适配器的东西设置操作命令?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5861589/