0

I am in the process of self-training on the subject of graphic JavaFX

My goal is to be able to place an X in the corresponding box

enter image description here

I found several tutorials that explain how to write a partial or full row but only one field and depending on the column / row value ... I can't do it, I need help from the community to m 'open my eyes, so run my hoop lol

Thx in advance

Have a nice day/evening/night/morning

  • 4
    Maybe a [`GridPane`](https://openjfx.io/javadoc/19/javafx.graphics/javafx/scene/layout/GridPane.html) would be better suited to your purpose than a TableView. – jewelsea Nov 02 '22 at 00:58
  • 4
    For a TableView, you don't update cells in the tableview directly, instead, you modify records in the list which backs the tableview, and those records need to be composed of listenable properties if you want to have updates on those properties trigger updates to the view. Study up on [cell factories](https://stackoverflow.com/questions/72437983/why-should-i-avoid-using-propertyvaluefactory-in-javafx) if you want to go this route. You might also want to look at [extractors](https://stackoverflow.com/questions/31687642/callback-and-extractors-for-javafx-observablelist). – jewelsea Nov 02 '22 at 00:59
  • Thx @jewelsea :) I will read about GridPane – Benoît Mignault Nov 02 '22 at 01:34

1 Answers1

0

With GridPane, i found what i probably need :)

@FXML
    protected void shootOnGrid(ActionEvent actionEvent) {
        if (column.getText().isEmpty() || line.getText().isEmpty() ){
            resultShoot.setText("There is some information missing");
        } else {
            resultShoot.setText(column.getText()+line.getText());
            grid.add(new Text(line.getText()), 0,0);

        }
    }

Now, i need to work with thoses property :) If i can name the Colomn and row...etc

enter image description here