1

I created a tableview with a feature that automatically wraps text to the next line when Enter is pressed and changes the state of the next row to edit mode using the following code:

Java

this.rowSelect = lastIndex;
            if (this.rowSelect < list.size()) {
                tableData.getSelectionModel().select(this.rowSelect + 1);
                tableData.edit(this.rowSelect, columnDiem);
            }
            tableData.setOnKeyTyped(event -> {
                TablePosition<List<StringProperty>, String> focusedCell = tableData.getFocusModel().getFocusedCell();
                if (focusedCell != null) {
                    tableData.getFocusModel().focus(focusedCell.getRow() + 1, columnDiem);
                    tableData.edit(focusedCell.getRow(), columnDiem);
                }
            });

When I debug the application, it runs perfectly fine. However, after building the JAR file, the display on the tableview starts to have problems. The selected row and the displayed edit cell start to misalign. I noticed that this error only occurs if the tableview has large row sizes that require scrolling.

I am using IntelliJ IDEA 2024.1, jdk 22.0.1, javafx 14, and jre 8u411 to run the JAR file.

enter image description here

I'm trying find what happen, I don't know why.

4
  • 1
    By “misalign,” do you mean that you expected the row with the edited cell to be the selected row? Commented Jun 6, 2024 at 12:41
  • Try to create a minimal reproducible example (from scratch), then edit your question to add it. Commented Jun 7, 2024 at 2:45
  • @VGR yes, editbox, it appears randomly, sometime below, sometime above Commented Jun 7, 2024 at 15:23
  • @Slaw I'm only use tableData.getSelectionModel().select(), tableData.edit() and tableData.getFocusModel().focus() to change. Commented Jun 7, 2024 at 15:26

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.