JList:Horizo​​ntal_WRAP 安装了吗?

发布于 2024-10-09 05:42:30 字数 259 浏览 0 评论 0原文

嘿,..我想在 jList 中显示带有名称的图片,我知道它也在 JPanel 中,但我现在使用 jList,没关系..

我的问题是为什么jlist 不适合仅在 2 个水平“单元格”中容纳图像,然后向下一行?

抱歉,我的英语很差,我不知道如何更好地描述它,但是看看图片,为什么 jlist 不将例如第三张图片设置在第二张图片旁边?

替代文本

Hey,.. i wanna show pictures with names onit in a jList, i know it get's also in a JPanel but i'm now using a jList, doesn't matter..

My question is why does the jlist don't fit the images only in 2 horizontal 'cells' and then go one row down?

sry my english is bad and i don't know how to describe it better, but look on the picture, why does the jlist dont set the e.g. 3rd picture right next to the 2nd?

alt text

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

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

发布评论

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

评论(2

淡水深流 2024-10-16 05:42:30

JList.HORIZONTAL_WRAPListDialog JWS 演示,如中所述初始化列表。我怀疑存在布局问题,但您可以将您的代码与那里找到的示例进行比较。

JList.HORIZONTAL_WRAP works correctly in the ListDialog JWS demo, as described in Initializing a List. I suspect a layout problem, but you might compare your code to the examples found there.

泪之魂 2024-10-16 05:42:30

如果使用 HORIZONTAL_WRAP,则可以使用 setVisibleRowCount 调整列数。如果您希望它们自动适应列表的宽度,请使用 0 或负数。

If you use HORIZONTAL_WRAP you can adjust the number of columns with setVisibleRowCount. If you want them automatically fitted to the width of the list, use 0 or something negative.

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