Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Create a lightweight collection view  RSS feed

 
Beau Tremblay
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to create a collection view, similar to the iOS Collection View. This collection view is associated with JTable so the user can toggle between views. I've implemented ResultSetGridPanel which is visually what I want (see image; proprietary chemistry is blurred) It is using a ModifiedFlowLayout and adding ReactionResultCellPanel which subclass JPanel.

The problem is I can have multiple tabs, each with their own grids, that can have up to 500 cells. So memory becomes a problem with thousands of JPanels.

I'd like to paint more like a JTable. Is is possible to either 1) reuse a single JPanel just for painting or 2) try to make ReactionResultCellPanel a subclass of JLabel and paint? I assume approach #1 means ResultSetGridPanel has a custom paint method, but I'd lose the benefits of my layout manager. Approach #2 seems like an easier approach if I can paint the cell properly.

I've attached the grid and cell classes. Thanks.

ResultSetGridPanel

ReactionResultCellPanel

CollectionView.png
[Thumbnail for CollectionView.png]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!