可滚动复选框
我需要制作一个可以包含未知数量元素的滚动框。即它需要能够滚动。我不太确定该怎么做。请帮忙。
I need to make a scroll box that can contain an unknown number of elements. Namely it needs to be able to scroll. I'm not quite sure how to do this. Please help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用 JScrollPane,其中包含 JPanel。这样,您就可以使用 JScrollPane 将任意数量的元素添加到 JPanel,而不会超过面板的物理大小。
以下是非常著名的 Oracle 教程的一部分,其中解释了 JScrollPane 元素:
http://download.oracle.com/javase/tutorial/uiswing/components /scrollpane.html
我希望这有帮助!
Use a JScrollPane with a JPanel wraped inside it. That way, you can add any number of elements to the JPanel without exceeding the panel's physical size using the JScrollPane.
Here is one part of the very famous oracle tutorial that explains the JScrollPane element:
http://download.oracle.com/javase/tutorial/uiswing/components/scrollpane.html
I hope this helps!
您想要将 JList 与自定义渲染器一起使用。
这是一个类似的问题。
You want to use a JList with a custom renderer.
Here's a similar question.