Results 1 to 1 of 1
- 01-28-2010, 04:04 PM #1
Member
- Join Date
- Jan 2010
- Posts
- 1
- Rep Power
- 0
Problems with Shift select in Jtable
Hi,
I want to get a situation where if a user holds down shift key and elects between two boolean check boxes shown in a Jtable it will check all the in between check boxes.
At the moment I have a messy solution where the class implements the KeyListener which toggles a boolean value when the shift key is pressed or released.
Then the Jtable (which the check box is in) has the addTableModelListener, which over writes the table Changed method to look at the e.getFirstRow() function to find the row number of the table, and depending on whether or not the boolean flag for the Shift value is true or false will choose whether to select the in between rows.
As I said before this is messy and doesn't work perfectly. (i.e. if already selected it doesn't toggle or if new selections are made etc.).
As the Shift function is quite a big function I was wondering if anyone knows of an easier way. I.e. different classes to implement or where to find similar solutions. I have already had a look around but couldn't find much.
Hope I have explained it clear enough
Thanks in advance,
Mark.
---Edit---
I suppose it may be worth mentioning that when the shift key is held and two points are selected the first and last point are check (assuming user selects the check boxes). But the others in between are just highlighted - what I need is a way for these to also to be checked when highlighted.
ThanksLast edited by kovski88; 01-28-2010 at 04:38 PM. Reason: Update
Similar Threads
-
How to retain value in struts 2 using <s:select></s:select> tag
By SaiPrasad@Sella in forum Web FrameworksReplies: 0Last Post: 02-09-2009, 07:23 AM -
Problems getting JTable to display information
By Gatts79 in forum AWT / SwingReplies: 2Last Post: 11-08-2008, 02:35 AM -
result select sql in jtable
By herfnai in forum JDBCReplies: 0Last Post: 08-17-2008, 12:20 PM -
result select sql in jtable
By herfnai in forum JDBCReplies: 0Last Post: 08-17-2008, 12:20 PM -
Problems with Jtable connected to data base
By elizabeth in forum AWT / SwingReplies: 2Last Post: 08-07-2007, 04:24 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks