0 Replies Latest reply: Nov 7, 2012 10:05 AM by drenda81 RSS

    TextFieldTableCell get textField

    drenda81
      Hi guys,
      can I get the textField on startEdit() in order to select all the text of the textField when a user click on the cell?
      Callback<TableColumn<ObservableScadenza, String>, TableCell<ObservableScadenza, String>> TextFieldTableCellFactory = new Callback<TableColumn<ObservableScadenza, String>, TableCell<ObservableScadenza, String>>() {
      
                @Override
                public TableCell<ObservableScadenza, String> call(
                          TableColumn<ObservableScadenza, String> arg0) {
      
                     return new TextFieldTableCell<ObservableScadenza, String>(new DefaultStringConverter()) {
                          @Override
                          public void startEdit() {                    
                               super.startEdit();
                               //TODO
                          }
                          public void updateItem(String item, boolean empty) {
                               // log.debug("updateItem");
                               try {
                                    BigDecimal bd = new BigDecimal(item);
                                    super.updateItem(bd.setScale(2).toString(), empty);
                                    return;
                               } catch (Exception e) {
                               }
                               // setTextFill(Color.RED);
                               super.cancelEdit();
                          };
                     };
                }
           };
      Thanks very much