Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6172223
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T23:21:22+00:00 2026-05-23T23:21:22+00:00

How can I set a custom comparator for a specific column in JTable? The

  • 0

How can I set a custom comparator for a specific column in JTable?

The third column of my table contains String representaion of double values and I want to creat a comparator for that column so that when I click on the header of that column it will sort according to that comparator.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T23:21:22+00:00Added an answer on May 23, 2026 at 11:21 pm

    The first question is why, if you are managing doubles, you are dealing with Strings. It should be better if you used the doubles and just set the format in the CellRenderer for that column.

    Anyway, what you are looking for may be this: http://download.oracle.com/javase/tutorial/uiswing/examples/components/TableSorterDemoProject/src/components/TableSorter.java


    EDIT: If somehow the translation from Double to your representation is complicated, I would create a Comparable class that contains both the Double number and the String representation. Equals(), hashcode() and compareTo() would be implemented using the value of the double; the cellRenderer() and toString() would use the String representation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In Flex how can I set a custom name (string) for the X axis
How can I set custom error levels with Zend Framework - say, I want
How can I set a custom filter in my code to ignore accents and
In Linux, can one set a custom icon for a folder/directory as it appears
When defining a custom operator from the limited set of single-character operators that can
I can set data in JTable constructor, and then user can change this data
How can I set custom width/height for the help viewer window for my my
In Xaml I can set a custom attached property using local:TestClass.TestProperty=1 An I can
I know I can set a custom allocator for vectors using the syntax vector<T,
So I know that you can set a custom default action in Zend Framework

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.