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.