在 Swing 中叠加多个 JSlider

发布于 2024-08-03 04:43:19 字数 180 浏览 9 评论 0原文

是否可以覆盖多个 JSlider,以便我可以看到两者上的“拇指”(我已尝试禁用轨道的绘制并将不透明度设置为 false,但其中一个仍然隐藏另一个)?基本上我想创建一个允许用户定义范围的组件(而且我真的不想编写自定义组件,因为它具有滑块的大部分属性)。如果有另一种方法可以用滑块来做到这一点,那也可以。

谢谢,

杰夫

Is it possible to overlay multiple JSliders so I can see the "thumbs" on both (I've tried disabling the painting of the track and setting opacity to false but one still hides the other)? Basically I'd like to create a component that allows the user to define a range (and I didn't really want to write a custom one since it has most of the attributes of a slider). If there is another way I could do that with a slider, that would work too.

thanks,

Jeff

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

不回头走下去 2024-08-10 04:43:19

啊,我找到了(我一定没有以正确的条件进行搜索)。 Swing 实验室作为 JXMultiThumbSlider 我认为可以解决这个问题。

http://swinglabs.org/ hudson/job/SwingX%20Weekly%20Build/javadoc/org/jdesktop/swingx/JXMultiThumbSlider.html

Ah, I found it (i must not have been seraching on the right terms). Swing labs as a JXMultiThumbSlider that I think will do the trick.

http://swinglabs.org/hudson/job/SwingX%20Weekly%20Build/javadoc/org/jdesktop/swingx/JXMultiThumbSlider.html

方圜几里 2024-08-10 04:43:19

我最近遇到了同样的问题,我想要一个带有两个拇指的滑块。我没有深入研究它,我最终为了获得范围所做的只是简单地放置两个滑块,并在“onSliderChange”事件侦听器中阻止一个比另一个小而另一个比另一个大。我不相信 Swing 有两个拇指滑块,尽管它可能是一个很酷的新功能,所以我认为这是您最好的选择。

I recently had the same problem, I wanted a slider with two thumbs. I didn't get into it too much, and what I ended up doing to get the range is simply putting two sliders and in the "onSliderChange" event listener prevented one beeing smaller than the other and the other bigger than the one. I don't beleive Swing has a two-thumb-Slider, although it might be a cool new feature to add, so I think this is your best bet.

幽梦紫曦~ 2024-08-10 04:43:19

JIDE 在其开源公共层中有一个带有 2 个拇指的 RangeSlider(顶部还有一个很好的额外的拇指,可以同时移动两个拇指(例如,拖动范围):http://www.jidesoft.com/products/oss.htm

JIDE has a RangeSlider with 2 thumbs (and a nice extra one on top to move both thumbs at once (e.g. drag the range around) in their open source common layer: http://www.jidesoft.com/products/oss.htm

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文