我可以向Swing组件 及其所有的内部装饰组件添加侦听程序(假设MouseAdapter)吗?Swing:将侦听器添加到组件并完成其装饰?
所以,当一个JInternalFrame处于由鼠标 移动(通过拖动窗口的标题栏),它会给我以下事件:
- 的mousePressed事件,
- 的mouseDragged事件,
- mouseReleased event。
目前,我收到了上述事件的没有拖动 的JInternalFrame时。
我希望有一些标准化的解决方案,但我找不到任何。
编辑:
有人建议使用的ComponentListener,但不会对 做我的。我需要知道,当用户停止拖动(mouseReleasedEvent), 而不是当组件移动。
MouseAdapter同时实现了,我添加使用 addMouseListener将(...)和addMouseMotionListener(...) – 2009-05-19 09:34:44