Skip to main content

How to perform an Action following a click on a part of a JXTable-Cell ?

2 replies [Last post]
tl5
Offline
Joined: 2008-11-20
Points: 0

Hi,

I have to simulate the behaviour of the Plus/Minus-Expand/Collapse-NodeHandle of a Tree(Table) in a JXTable.
Yes, I considered using the JXTreeTable, but need filtering and sorting of the JXTable. :-)

I can think of two ways to accomplish this:

1. Using a CompoundComponent (+/- Button and TextField) as a CellEditor and immediately stop the CellEditing on a button-click. Then changing the filtered rows according to the state of the node (persisted in two properties of my DataClass.)

2. Handling the mouseclick as showing a popup menu on a Table; listen for a single click and identify the clicked (region of the) cell. The problem is getting the click coordinates IN the Component.
I searched the sources of JTree for hints, but got lost...

Can someone help me to exclude one of these "ideas" or direct me to a better solution?

Thanks!

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
kschaefe
Offline
Joined: 2006-06-08
Points: 0

You can look at our check list implementation for ideas. We need to listen for a click in the checkbox region to toggle the check. The HotSpotAware interface is added to a renderer to determine hot spot hit detection.

https://jdnc-incubator.dev.java.net/source/browse/jdnc-incubator/trunk/s...

Karl

kleopatra
Offline
Joined: 2003-06-11
Points: 0

same way as in a core JTable, no additional support in JXTable

Jeanette