Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 a 中有一个组件JScrollPane,我想处理一些滚动事件。但是,我不想处理所有这些。不幸的是,当我将 a 添加MouseWheelListener到我的子组件时,滚动停止接收滚动事件。
JScrollPane
MouseWheelListener
如何“传递”我不想手动处理的事件?
关于什么?
Component.dispatchEvent(AWTEvent e);
基本上你需要打电话:
getParent().dispatchEvent(mouseEvent);
现在您可能需要挖掘 scrollPane,但您可以尝试一下这个想法