0

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?

jzd
  • 23,473
  • 9
  • 54
  • 76
Ashish
  • 1,527
  • 4
  • 17
  • 33
  • possible duplicate of [JFileChooser with tree and check box](http://stackoverflow.com/questions/6274668/jfilechooser-with-tree-and-check-box) – jzd Jun 08 '11 at 11:17

3 Answers3

3

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

unholysampler
  • 17,141
  • 7
  • 47
  • 64
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.

Suraj Chandran
  • 24,433
  • 12
  • 63
  • 94
3

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.

Community
  • 1
  • 1
Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433