1

Is it possible to do something like the following image in Java?

I understand that I would need to be using a multi columned list, with a custom cell renderer, in order to show the images of each list element. But my question is regards to Grouping the list elements, and using group headers...

image of a grouped list view

As you can see from the image above this comes from windows explorer and is exactly the type of grouped list view that I would be looking to do with a JList in Java.

Community
  • 1
  • 1
John McDonnell
  • 753
  • 1
  • 8
  • 24

1 Answers1

1

I don't think I would use a JTable in this situation.

First of all, I'd use a simple JPanel with DesignGridLayout, something like the example demonstrated in DesignGridLayout showdown application, section "Dynamic Layouts", example "Example 4 - Same with indented rows".

In that example you'd have to change the icons used for the outline effect (triangles instead of chevrons in the example).

Then, I would create a DrivePane deriving from JPanel, that would contain the drive icon as a JLabel (with no text), the drive name as a JLabel, the size as a JProgress bar, the size as a JLabel. I would probably use GridBagLayout as the LayoutManager for DrivePane. That component would be used for every drive to show.

jfpoilpret
  • 10,449
  • 2
  • 28
  • 32
  • 'I would use GridBagLayout', coming from _you_? Probably should remove DesignGrid from my list of highly recommended managers if it can't do this easily ... grinning :-) – kleopatra Sep 13 '11 at 06:43
  • @kleopatra hehe very good ;-) I am all for "use the right tool for the job" and I don't think DesignGrid would be able to handle the drive panel which is a bit specific. – jfpoilpret Sep 13 '11 at 06:50