Circle JSlider - Java 程序

发布于 2024-11-29 19:40:46 字数 83 浏览 5 评论 0原文

有人可以向我展示设置 JSlider 的代码吗?除了它不是拇指而是一个圆圈之外?具体来说,它不是指向当前位置的小三角形,而是宽度为 100 的蓝色圆圈;

Can someone show me code that will set up a JSlider except, instead of a thumb, it is a circle? Specifically, instead of that little triangle which points to the current position, it is a blue circle of width 100;

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

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

发布评论

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

评论(1

揪着可爱 2024-12-06 19:40:46

假设您使用的是 Metal L&F,您可以扩展 javax.swing.plaf.metal.MetalSliderUI 并覆盖 horizThumbIconvertThumbIcon 作为您的圆圈。然后使用 slider.setUI() 将此 UI 设置为您想要的 UI,

看看这里的答案,它对 JComboBox 执行更改 如何更改箭头样式JComboBox

Assuming you're using the Metal L&F you could extend javax.swing.plaf.metal.MetalSliderUI and override the horizThumbIcon or vertThumbIcon to be your circle. Then set this UI to be UI you'd like for your sider using slider.setUI()

look at this the answer here which performs a change for a JComboBox How can I change the arrow style in a JComboBox.

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