Results 1 to 1 of 1
  1. #1
    kovski88 is offline Member
    Join Date
    Jan 2010
    Posts
    1
    Rep Power
    0

    Default 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.

    Thanks
    Last edited by kovski88; 01-28-2010 at 04:38 PM. Reason: Update

Similar Threads

  1. How to retain value in struts 2 using <s:select></s:select> tag
    By SaiPrasad@Sella in forum Web Frameworks
    Replies: 0
    Last Post: 02-09-2009, 07:23 AM
  2. Problems getting JTable to display information
    By Gatts79 in forum AWT / Swing
    Replies: 2
    Last Post: 11-08-2008, 02:35 AM
  3. result select sql in jtable
    By herfnai in forum JDBC
    Replies: 0
    Last Post: 08-17-2008, 12:20 PM
  4. result select sql in jtable
    By herfnai in forum JDBC
    Replies: 0
    Last Post: 08-17-2008, 12:20 PM
  5. Problems with Jtable connected to data base
    By elizabeth in forum AWT / Swing
    Replies: 2
    Last Post: 08-07-2007, 04:24 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •