How to disable scrolling from mouse wheel in a JScrollPane header?

时光怂恿深爱的人放手 提交于 2019-12-04 19:56:09

I think you need a 2 step solution.

  • To disable/enable the scroll wheel for the whole component, use setWheelScrollingEnabled() on the JScrollPane.

  • To do this selectively, do addMouseListener() on the JScrollPane to catch all mouse movement (including entering and leaving) so you'll know when the pointer is in the header. Whenever this changes, you can turn scrolling on or off.

Anonymous

yourJTable.getTableHeader().setReorderingAllowed(false);

should work, try it out.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!