• Post Reply Bookmark Topic Watch Topic
  • New Topic

TreeCellEditor  RSS feed

Serghei Jelauc
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all.
I have the following problem.
I created my own class MoneyEditor wich extends DefaultCellEditor. In this class I defined the JFormattedTextField with the NumberFormat.getCurrencyInstance(Locale.US);. I override the getTableCellEditorComponent(), getCellEditorValue(), stopCellEditing() methods, and set this editor on one of my table's column. All works fine, but after I made some changes in the cell (in JFormattedTextField) and leave this cell the data in the cell is changed.
For example if I inserted $25.00 after leaving the cell it shows only 25 When I double click on this cell again the data is shown normal $25.00.

As I understood when I double click on the cell I enter in the JFormattedTextField, when I leave the cell this field is hide by the DefaultCellrenderer which is JLabel. How I can force JLabel to show correct data from the JFormattedTextField.

May be my theory is wrong. Could somebody explain me how to solve this problem?

Thanks in advance.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!