Javafx 8 : Populating a TableView in initialize method

You replace your TableView in your initialize method. table =new TableView<Employee>(employees); You assign the data to the new TableView and leave the one created from the fxml empty. Instead use the one injected by the FXMLLoader: @Override public void initialize(URL location, ResourceBundle resources){ super.initialize(); dao = (DAO<Employee>) dFact.getEmployeeDAO(); try { employees = dao.findAll(); // set … Read more

Dynamic Bar chart in Java FX

Here is mcve demonstrating a mechanism to couple changing data to a BarChart. There are other ways to achieve this “binding”, but I tried to keep is simple. The bubble sort algorithm is not relevant to the question, not the answer , so it is better left out. An mcve needs to demonstrate the question … Read more

How to get GridPane Row and Column IDs on Mouse Entered in each cell of Grid in JavaFX?

You can get the values by calling GridPane.getColumnIndex(node) and GridPane.getRowIndex(node). You haven’t shown what you’re putting in the grid pane, and even whether you are populating it in FXML or in Java, but here’s some basic functionality. Here I (tediously) populate the GridPane in FXML, it might be better to populate it in Java (i.e. … Read more

Localdate.format, format is not applied

Don’t format your date for insertion into your SQL database. Assuming that your database column has datatype date and you are using at least Java 8 and at least JDBC 4.2, just pass the LocalDate to your PreparedStatement as it is: PreparedStatement insertStmt = myConnection.prepareStatement( “insert into my_table(purchase_date) values (?)”); insertStmt.setObject(1, purchaseDate); Your JDBC driver … Read more

AutoCompletionBinding cannot access class com.sun.javafx.event.EventHandlerManager

If you are using ControlsFX 11, add the following VM option to your runtime command line: –add-exports javafx.base/com.sun.javafx.event=org.controlsfx.controls Note: Previous answers (on other sites and also here on SO) have suggested the following: –add-exports javafx.base/com.sun.javafx.event=ALL-UNNAMED However, recent versions of ControlFX appear to be modularized and the modules are no longer unnamed. If you are using … Read more

JavaFX ComboBox change value causes IndexOutOfBoundsException

In JavaFX, you cannot change the contents of an ObservableList while a change is already in progress. What is happening here is that your listeners (any of the ones you try) are being fired as part of the box.getSelctionModel().getSelectedItems() ObservableList changing. So basically, you cannot change the selection while a selection change is being processed. … Read more

CubicCurve JavaFX

I think CubicCurves in JavaFX don’t quite work as you think they might. A JavaFX CubicCurve is a Bezier curve which is quite different from the cubic polynomials such y=x^3 you normally encounter in high school mathematics. Everything you never wanted to know about Bezier curves is here. Bezier curves are often used for generating … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)