I'm using JavaFX (With jfoenix) to build my application with SceneBuilder for designing.
I want to build a textview reflection for a table cell, something like in Microsoft Excel (Allow the user to more easily edit the text)
- When the user will click/type on some cell in the table, The TextArea will immediately update with the cell text
- The opposite - When the user will type in the TextArea, The cell will update on every pressed key.
What have I done until now?
- Create the JFXTreeTableView with all the info.
- Create the TextView.
- Update the TextView when the user choose (or finish the edit cell) some cell on the table - the code is below.
What I have not success to do until now?
- Update the cell when the user edit the TextArea (On every change).
Update the TextView on every change of the cell editing.
treeView.setOnMousePressed(e -> {
if (e.isPrimaryButtonDown()) { updateTextArea(); updateDetailsText(); } }); private void updateTextArea() { TreeTableView.TreeTableViewFocusModel<ModelTable> tfm = treeView.getFocusModel(); TreeTablePosition<ModelTable, ?> tablePosition = tfm.getFocusedCell(); TreeTableColumn<ModelTable, ?> tableColumn = tablePosition.getTableColumn(); int rowIndex = treeView.getFocusModel().getFocusedCell().getRow(); String data = tableColumn.getCellData(rowIndex).toString(); edit_cell_text.setText(data.toString()) }
I could not find any example/clue to anything like this on the net, I'd love to know if it's possible.
Thanks a lot!