Results 1 to 5 of 5
  1. #1
    jobi is offline Member
    Join Date
    Sep 2011
    Posts
    14
    Rep Power
    0

    Default Sorting in JTable

    I have a jTable on my Frame. I added data to jTable by model.add(..). How can i sort those data based on which table header i clicked?

  2. #2
    camickr is offline Senior Member
    Join Date
    Jul 2009
    Posts
    1,227
    Rep Power
    6

    Default Re: Sorting in JTable

    Read the JTable API and you will find a link to the Swing tutorial on "How to Use Tables" which explains how to do this.

  3. #3
    jobi is offline Member
    Join Date
    Sep 2011
    Posts
    14
    Rep Power
    0

    Default Re: Sorting in JTable

    Can you please share the link?. It may be more helpful.

  4. #4
    camickr is offline Senior Member
    Join Date
    Jul 2009
    Posts
    1,227
    Rep Power
    6

    Default Re: Sorting in JTable

    I don't have the link memorized. I would have to open up the API and copy the link. I'm sure you can do the same thing and if you did so already you would be busy reading the tutorial and have your answer by now.

    You can't program if you don't have access to the API. Learning how to read the API will solve many problems.

  5. #5
    jobi is offline Member
    Join Date
    Sep 2011
    Posts
    14
    Rep Power
    0

    Default Re: Sorting in JTable

    Thanks. I got the API and sorting is working fine.

Similar Threads

  1. Auto sorting JTable by second column
    By d3n1s in forum Advanced Java
    Replies: 6
    Last Post: 05-06-2011, 01:56 AM
  2. Sorting and hiding columns in JTable
    By ProgrammingPup in forum Advanced Java
    Replies: 1
    Last Post: 11-17-2009, 09:59 PM
  3. JTable sorting
    By mtyoung in forum Advanced Java
    Replies: 6
    Last Post: 11-10-2009, 05:59 AM
  4. Sorting JTable
    By mm2236 in forum AWT / Swing
    Replies: 0
    Last Post: 04-09-2009, 04:37 PM
  5. sorting JTable
    By mansi_3001 in forum Advanced Java
    Replies: 3
    Last Post: 08-10-2007, 06:29 PM

Posting Permissions

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