This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
I have a java table that gets/saves data from/to a sql table. The field in the database is set to: float (type), 15 (length) && 3 precision.
Whenever I enter a value 9 000 000 or under it shows me the value I typed and the value saved in the database is correct but as soon
as its greater than 7 characters eg: 11 000 000 then on screen it immediately converts to hex value 1.1E7 but in the database it is still
saved correctly as 11 000 000.
Any ideas on how I can stop the value from displaying in hex form?
Maja Gralewska wrote: . . . converts to hex value 1.1E7 . . .
That isn't hex, but scientific notation.
Anyway, Rob has already given you a solution.
Joined: Sep 26, 2008
Im sorry but i am confused as to how i would use that? I am not trying to print the value out, when a user enters a value in my gui table and if say that value is 11000000 and tabs to the next col then it immediately defaults the value to 1.1E7. I need the value to stay what the user has typed on screen. Maybe I am not explaining correctly I have added a bmp to show what i mean more clearly.
There is a difference between what the number IS and how it is DISPLAYED. "10", "TEN", "X", "1010" "0xA", and "1E1" all represent the same number, it's simply a difference in how you present the data to the user. It's a display issue, not a data issue.
I'm not sure how tables would work - is there a property on the table to prevent that? some kind of formatting?
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
That's what TableCellRenderers do. They take a value and return a Component to display it. Similarly, TableCellEditor returns a Component to edit a value, and return the new edited value from the Component when done.
Joined: Sep 26, 2008
Thanks guys, this kinda helped but also kind of didn't, when i click finish and reload the screen the data now loads as a normal decimal but in the
initial entry on tab it still auto changes to scientific, i have tried a few thing but i cant seem to get it to work straight after tab.