A
A
Anton @ Lyalin2017-04-09 10:43:14
JavaFX
Anton @ Lyalin, 2017-04-09 10:43:14

Why won't the javafx window launch??

There is a window with a TableView, in the controller I pass it a list with data, but it does not start.
I don’t remember exactly how I did it, but I received and showed the data, now it doesn’t show and starts.

Контроллер
public class FilterController implements Initializable {
    public TableView<Filter> tableView;
    public TableColumn<Filter, String> columnWord;
    public TableColumn<Filter, Integer> columnFrequency;

    @Override
    public void initialize(URL location, ResourceBundle resources) {
        Filter filter = new Filter();

        columnWord.setCellValueFactory(new PropertyValueFactory<>("word"));
        columnFrequency.setCellValueFactory(new PropertyValueFactory<>("number"));

        tableView.setItems(filter.wordAndNumber());
    }
}

The Filter class, in which I type data into the sheet
ObservableList<Filter> wordAndNumber(){
        ObservableList<Filter> list = FXCollections.observableArrayList();
        String[] strings = delSymbol().split(" ");
        for (int i = 0; i < strings.length; i++) {
            list.add(new Filter(strings[i], i));
        }

        return list;
    }

And the class Main (window)
public void start(Stage primaryStage) throws Exception {
        AnchorPane pane = FXMLLoader.load(getClass().getResource("sampleFilter.fxml"));

        Scene scene = new Scene(pane);
        scene.setFill(Color.web("eff0f1"));

        primaryStage.setResizable(false);
        primaryStage.setTitle("Фильтр");
        primaryStage.setScene(scene);
        primaryStage.show();
    }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton @ Lyalin, 2017-04-09
@toxa_1995

The issue is resolved, because I do not receive text from the field, therefore it does not start.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question