Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JTreeTable - selecting nodes with mouse & CTRL key

843804May 1 2003 — edited Oct 16 2004
Hi

I have a JTreeTable using an subclass of AbstractTreeTableModel (see "Creating TreeTables in Swing" http://java.sun.com/products/jfc/tsc/articles/treetable1/index.html).

My problem is using the mouse and CTRL key to select nodes in the tree. If I click on the table portion of the tree node (ie, the standard JLabel renderered columns in the table) with the CTRL key depressed, I get the behaviour I expect (multiple selection of non-adjacent rows). If I click on tree portion (ie, the column rendered using JTree) with the CTRL key depressed, the rows are not selected. It appears that the mouse events are being consumed before they can be handled by JTable's mouse listeners. What is strange is that holding down the SHIFT key produces the expected behaviour when clicking in both the tree and table portions of the JTreeTable (multiple selection of adjacent rows).

My code does not add/remove any key or mouse listeners and relies on the JTreeTable handling all mouse and keyboard events so this looks like standard behaviour for JTreeTable.

Anyone with ideas as to where I should start looking for a solution ?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 13 2004
Added on May 1 2003
3 comments
204 views