Store products in a TreeSet and print the content in a JTable

后端 未结 1 1958
既然无缘
既然无缘 2020-12-22 05:53

I\'m trying to create a GUI which will let the user introduce and remove products in a GUI, by using a TreeSet. The user specifies the product name and the quantity, before

相关标签:
1条回答
  • 2020-12-22 06:09

    Extend AbstractTableModel as shown here. In this case, you can access the TreeSet in your implementation of getValueAt(), et al., as shown here for Map. Because TreeSet implements SortedSet, the toArray() method will return a sorted array of Product based on your implementation of Comparable.

    0 讨论(0)
提交回复
热议问题