当我将焦点放在工具栏上的 JButton 上时,添加到 JScrollPane 的 JToolbar 将滚动

发布于 2024-12-15 20:50:07 字数 370 浏览 4 评论 0原文

当我已经滚动到我想要去的地方时,如何避免 JScrollPane 滚动,其中添加了 JToolbar,其中有按钮?如果我将鼠标移到工具栏上的 Jbutton 上(我禁用了滚动窗格滚动条并禁用了 JToolbar 和 JScrollPane 的自动滚动),我将鼠标移到突出显示的第一个 Jbutton 上,然后整个 JToolbar 向右移动,直到最后一个按钮对齐与 JScrollPane 可见区域的右侧边缘。

另外,作为可能问题根本原因的线索,我在应用程序中的另一个 JToolbar 上注意到,如果我通过将鼠标移到按钮上将焦点放在按钮上,它会导致另一个窗口中的工具栏滚动(如果它已经滚动)。

我正在尝试实现一个可滚动的工具栏,如果您知道可行的实现,请告诉我。

谢谢, -托尼

How do I avoid having the JScrollPane scroll that has a JToolbar added to it that has buttons when I have already scrolled to where I want to go? If I move my mouse over a Jbutton on the toolbar (I disabled the scrollpane scrollbars and disabled autoscroll for both the JToolbar and the JScrollPane) the first Jbutton I move the mouse over highlights then the whole JToolbar moves right till the last button is lined up with the right side edge of the visible area of the JScrollPane.

Also as a clue possibly to the root cause of the problem I noticed on a different JToolbar in my application if I put focus on a button by moving the mouse over the button it causes the toolbar in another window to scroll if it was already scrolled.

I am trying to implement a scrollable toolbar and if you know of a implementation that works please let me know.

Thanks,
-Tony

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文