Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Create a lightweight collection view

 
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]
 
You have to be odd to be #1 - Seuss. An odd little ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic