Ashish
Ashish

Reputation: 1567

change look and feel of JFileChooser in swing

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?

Upvotes: 0

Views: 1243

Answers (3)

Andrew Thompson
Andrew Thompson

Reputation: 168825

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.

Upvotes: 3

Suraj Chandran
Suraj Chandran

Reputation: 24791

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.

Upvotes: 3

unholysampler
unholysampler

Reputation: 17321

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

Upvotes: 3

Related Questions