Search code examples
javaswinghighlightcheckboxlist

Creating a checkbox java list


i am trying to generate a checkbox list feeded by some records from a database just like the image (JAVA Swing), initially i tried with several chexkboxes but it didn't work, now i am trying with a multiple selection list but it didn't work as well and none of the answered questions here looks like to solve the specific needs i have.

Specifications:

  • Multiple selection list.
  • Every node of the list must have a checkbox object.
  • When checked every node must stay highlighted.
  • It must have an scrollbar if the content is bigger to the initially setted dimentions.

Solution

  • It must have an scrollbar if the content is bigger to the initially set dimensions.

    Put the JList inside a JScrollPane.

    When checked every node must stay highlighted.

    This is going to confuse the user. The check marks are sufficient.

    Every node of the list must have a check box object.

    You'll have to extend a JList and a ListCellRenderer to gain this functionality. The ListSelectionListener that I have is over 100 lines of code.

    You might find an already existing check box JList on the web. I have one in a book.