change look and feel of JFileChooser in swing

2019-08-16 01:09发布

My requirement is to add check box with every directory which is shown by JFileChooser. and give multi selection facility.

How can I achieve this?

3条回答
Melony?
2楼-- · 2019-08-16 01:17

I think it can be done this way. Override MetalFileChooserUI.createList() and return your own custom list panel. Therein, add checkbox renderers to the items in your list.

查看更多
贪生不怕死
3楼-- · 2019-08-16 01:25

It would probably be easier to implement a custom component than alter a JFileChooser to support this (odd) requirement. You might start with altering the component used in File Manager questions.

查看更多
霸刀☆藐视天下
4楼-- · 2019-08-16 01:36

JFileChooser has multi-selection built in (setMultiSelectionEnabled()). It doesn't use checkboxes, but you can select multiple items.

查看更多
登录 后发表回答