This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes Sorting JTable with scientific notation doubles in Win32 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Sorting JTable with scientific notation doubles in Win32" Watch "Sorting JTable with scientific notation doubles in Win32" New topic
Author

Sorting JTable with scientific notation doubles in Win32

Fernando Muniz
Greenhorn

Joined: May 19, 2010
Posts: 2
I have quite an opaque problem.

I have a regular JTable that I have filled with values coming from a text file, a report. Some of these fields contain double numbers, formatted in the scientific way (e.g. 1.25E-7).
My methodology is to parse these strings to a double and fill the table column with the result. On failure to parse the number, I insert a "Double.NaN"



Next I have a table sorter. As the code is now, if you click on the column header containing the double numbers, it will sort the scientific notation values correctly under Linux, Mac, and WindowsXP 64bits but NOT under WindowsXP 32bits. In that OS, it seems to sort the rows by its string value, not as a scientific notation double (eg. 1.25E-3 before 2.56E-5).
What the 'ellll am I doing wrong!?

Here is the row sorter code:

Fernando Muniz
Greenhorn

Joined: May 19, 2010
Posts: 2
Yeah, OK... I'll kick myself in the butt for blindness induced stupidity....



Just removed this part and it worked.
Move on, nothing to see!
 
 
subject: Sorting JTable with scientific notation doubles in Win32
 
Similar Threads
Sorting data table problem
determine the input type of the value of the function parameter map
Scrolling + sorting a datatable
Sorting the Rows in a JTable Component Based on a Column
Sorting Collection