JScrollBar,删除keyListener?
嘿,大家好,只是问一个我在任何地方都没有找到的东西。我向 JPanel 添加了一个带有 2 个 JScrollBar 的滚动窗格。一竖一横。一切正常,只是我不希望滚动条使用箭头键滚动。我该如何实现这一目标?
我一直在检查调整监听器,但确实没有发现任何对我来说有价值的东西。感谢您的帮助!
Hey you all, just a quick question of what i havent found anywhere. Im adding a scrollpane to a JPanel, with 2 JScrollBars. One vertical and one horizontal. Everything works fine just that i dont want the ScrollBars to scroll using the arrow keys. How do i achieve this?
I´ve been checking out adjustmentlisteners but really havent found anything of high value to me. Thanks for any help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须调整scrollPane的inputMap中的键绑定并将导航键指向nirwana,例如:
要查找注册了哪些keyStrokes,请查看BasicLookFeel - getDefaults中与“ScrollPane”相关的部分
注意:这是非常不寻常的,您的用户可能会生气!
you have to tweak the keybinding in the scrollPane's inputMap and point the navigation keys into nirwana, like:
to find which keyStrokes are registered, look into the BasicLookFeel - the section in getDefaults which relates to "ScrollPane"
Beware: that's highly unusual, you user's might be annoyed!