Results 1 to 3 of 3
  1. #1
    yatin is offline Member
    Join Date
    Jun 2010
    Posts
    5
    Rep Power
    0

    Question jtable setrawselectioninterval problem

    Hello everyone

    i need help in following problem

    i have create one jtable with data in jpanel,
    and i have put FIND functionality , when we press find button it ask input


    EXAMPLE
    if one of the cell of Jtable contain "yatin" value AND IF I HAVE PROVIDE INPUT IN FIND TEXTBOX AS "yatin" it dark the row of the jtable using this method setRowSelectionInterval of jtable,

    when i update the jtable and same find procedure follows , i not get raw selection

    please help me

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,447
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by yatin View Post
    Hello everyone

    i need help in following problem

    i have create one jtable with data in jpanel,
    and i have put FIND functionality , when we press find button it ask input


    EXAMPLE
    if one of the cell of Jtable contain "yatin" value AND IF I HAVE PROVIDE INPUT IN FIND TEXTBOX AS "yatin" it dark the row of the jtable using this method setRowSelectionInterval of jtable,

    when i update the jtable and same find procedure follows , i not get raw selection

    please help me
    Try this one: first you set a sorter on your table:

    Java Code:
    table.setRowSorter(sorter= new TableRowSorter<YourTableModel>(yourModel));
    Given a JTextField that contains the wanted value add a filter to your sorter:

    Java Code:
    sorter.setRowFilter(RowFilter.regexFilter(field.getText()));
    That's all there is to it ...

    kind regards,

    Jos

  3. #3
    yatin is offline Member
    Join Date
    Jun 2010
    Posts
    5
    Rep Power
    0

    Smile get solution for setrawselectioninterval working in jtable

    hello jos

    first of thank you for your reply,

    i got the solution using this code line


    tbl.setCellSelectionEnabled(true);
    tbl.changeSelection(i, j, false, false);
    //tbl.setRowSelectionInterval(i,i);
    tbl.requestFocus();

Similar Threads

  1. JTable problem
    By sandeepsai39 in forum New To Java
    Replies: 2
    Last Post: 06-27-2009, 06:15 AM
  2. Problem With AI and JTable
    By elad_bj in forum New To Java
    Replies: 8
    Last Post: 04-20-2009, 02:24 PM
  3. JTABLE problem
    By MaximInf in forum AWT / Swing
    Replies: 4
    Last Post: 06-21-2008, 10:45 AM
  4. Replies: 2
    Last Post: 05-15-2008, 10:15 AM
  5. Problem with JTable
    By Felissa in forum AWT / Swing
    Replies: 2
    Last Post: 07-04-2007, 09:25 AM

Posting Permissions

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