craftleft.gif (3002 bytes)QuickTable
Home | API | Tutorial | Download | Support | Contact topblack.gif (108 bytes)


QuickTable User Cp  |  Register  |  Members  |  Search  |  Help
    |- QuickTable Discussion Forums > Column Post New Topic   Post A Reply
Format 1.234.567,00 printer friendly version
next newest post | next oldest post
Author Messages
Lex-Luthor
Private

Gender: Unspecified
Location:
Registered: Mar 2005
Status: Offline
Posts: 7

Click here to see the profile for Lex-Luthor Send email to Lex-Luthor Send private message to Lex-Luthor Find more posts by Lex-Luthor Edit or delete this message Reply w/Quote
Posted Wednesday, September 7, 2005 @ 02:48:45  

Hi.
I want to format a column that has numeric data to show the next:
If number is 1234567 I want to see 1.234.567,00 or If number is 0 I need to see 0,00. I´ve tried to use setPrecision and setScale methods of the colum, but it shows no change.

Thanks.

Admin
Board Owner

Gender: Unspecified
Location:
Registered: Jul 2003
Status: Offline
Posts: 9

Click here to see the profile for Admin Send email to Admin Send private message to Admin Find more posts by Admin Edit or delete this message Reply w/Quote
Posted Wednesday, September 7, 2005 @ 10:52:45  

First you need to tell quicktable about how to do the conversion from 1234567 to 1.234.567,00 .This can be done by creating your own implementation of DataMap class. Then assign the DataMap instance to the column using getColumn(1).setDataMap( yourMap); Please refer api of DataMap class, a sample implementation is provided there.

Even though you have handled the display format of the number using the DataMap class, if the column is editable, then users may enter data which does not confirm to your numeric format. If you want to further restrict the users in entering the numbers in your format, then you may want to create an instance of javax.swing.text.Document, which can do the validation and then assign to the column using getColumn(1).setDocument( yourDoc); A sample implementation to validate an IP address can be found in the CustomerOrderDemo.java sample.

If possible, after your have implemented the above, please post the code to this thread, so that it will be helpful for others.

Post New Topic   Post A Reply Jump to:
Contact Us | QuickTable - A Java DBGrid | Privacy Policy All times are GMT -5 Hours.
Welcome to QuickTable Forums, Guest!  
Login
Username :
Password :
In order to fully utilize the abilities of this board, you are required to register as a member. Registration is free, and allows you to do lots of things including turning on or off certain features of this board. Register now!
Powered by CuteCast v2.0 BETA 2
Copyright © 2001-2003 ArtsCore Studios