Beau Tremblay

+ Follow
since Jul 16, 2013
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Beau Tremblay

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.



4 years ago
I understand for a simple table model, all that is required to show a Boolean as a checkbox is to 1) override getColumnClass to return a Boolean for that column and 2) override isCellEditable. I've run simple examples, and the checkbox appears fine.

I have a class called ResultSet used to store a collection of data which extends AbstractTableModel

In the table's view class, I have a method which sets up the table columns:

The problem is the checkbox is not appearing when rendered. I see "true" or "false". Here is my renderer factory:

If I add back the commented line, where a Boolean.class column uses the custom CheckBoxRender, it works. Though shouldn't the DefaultTableCellRenderer handle this case fine?

Thanks for any insight.
6 years ago