change look and feel of JFileChooser in swing

非 Y 不嫁゛ 提交于 2019-12-13 05:20:45

问题


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?


回答1:


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.




回答2:


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




回答3:


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.



来源:https://stackoverflow.com/questions/6226104/change-look-and-feel-of-jfilechooser-in-swing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!