JTable cell double values
Hi,
I have JTable with 4 columns. In second column I would like to have float values with pattern any_count_of_numbers.just_one_number.
I created JFormattedTextField with this format and I used it as cell editor in DefaultCellEditor. But this doesn't work.
When I created "standalone" JFormattedTextField with desired format, then it works.
I don't know if this issue is relate to cell editor.
Do you have any idea?
Many thanks
Vladislav
[488 byte] By [
valenta] at [2007-11-26 22:20:37]

# 1
If you need further help then you need to create a [url http://homepage1.nifty.com/algafield/sscce.html]Short, Self Contained, Compilable and Executable, Example Program[/url] (SSCCE) that demonstrates the incorrect behaviour, because I can't guess exactly what you are doing based on the information provided.
Don't forget to use the [url http://forum.java.sun.com/help.jspa?sec=formatting]Code Formatting Tags[/url] so the posted code retains its original formatting.
# 2
Sorry for unclear explanation.
I ask in other way.
I would like to have in one column in JTable just double values with specific format. Any other input should by rejected.
I tried to modify TableCellEditor like this:
private TableCellEditor table()
TableCellEditor tce = null;
NumberFormat format = new DecimalFormat("#.#");
JFormattedTextField textField = new JFormattedTextField(format);
tce = new DefaultCellEditor(textField);
return tce;
then I tried to use this TableCellEditor
column.setCellEditor(table());
But the cells still accept all types - Strings, int...