开发者

Multi column list in Swing

开发者 https://www.devze.com 2023-01-26 19:35 出处:网络
First of all, I\'m using Swing in Java. In my application, I need to have a multi column list (if that\'s what I should call it). What I mean by a multi column list is something like windows explorer\

First of all, I'm using Swing in Java. In my application, I need to have a multi column list (if that's what I should call it). What I mean by a multi column list is something like windows explorer's list view mode of showing files and folders.

So, all of the columns of my list are going to have the same object (files for instance), but I 开发者_运维技巧want to be able to put them on different columns, in order to have a wider view.

Does anyone have any suggestion how I can do that?

Thanks, Reza


One may use:

list.setLayoutOrientation(JList.HORIZONTAL_WRAP);


Alternatively you can use a JScrollPane. This will handle creating scroll bars and such for you, which would solve the issue of running out of vertical space, and thus eliminating the need for extra columns.

0

精彩评论

暂无评论...
验证码 换一张
取 消