How to add a value marker to JavaFX chart?

To convert chart values to pixels you can use method NumberAxis#getDisplayPosition() which return actual coordinates of the chart nodes. Although these coordinates are relative to chart area, which you can find out by next code: Node chartArea = chart.lookup(“.chart-plot-background”); Bounds chartAreaBounds = chartArea.localToScene(chartArea.getBoundsInLocal()); Note localToScene() method which allows you to convert any coordinates to Scene … Read more

How to fill up a TableView with database data

Here is the best solution for the filling data to the tableView From the database. import java.sql.Connection; import java.sql.ResultSet; import javafx.application.Application; import javafx.beans.property.SimpleStringProperty; import javafx.beans.value.ObservableValue; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.scene.Scene; import javafx.scene.control.TableColumn; import javafx.scene.control.TableColumn.CellDataFeatures; import javafx.scene.control.TableView; import javafx.stage.Stage; import javafx.util.Callback; /** * * @author Narayan */ public class DynamicTable extends Application{ //TABLE VIEW AND … Read more

JDK11/JavaFX: How do I make a fat jar without build/depdency management?

This has been answered a few times already for Maven and Gradle. Build tools make things way easier than doing it on command line, and not only because of the dependency management. Since you ask specifically about command line, there is already a full set of instructions documented for it here: https://openjfx.io/openjfx-docs/#modular. Non modular App … Read more

Customize ListView in JavaFX with FXML

I understand your question. There are mainly two ways to set items in a Listview: 1. Create the ObservableList and set the items of the ListView with the ObservableList (listView.setItems(observableList)). 2. Use the setCellFactory() method of the ListView class. You would prefer to use the setCellFactory() method, because this approach simplies the process as well … Read more

How to right align a button in Java FX toolbar

Add a pane with no content which always grows to fit available space between the left aligned tools in the bar and right aligned ones. <?xml version=”1.0″ encoding=”UTF-8″?> <?import javafx.scene.control.*?> <?import javafx.scene.layout.*?> <ToolBar prefHeight=”40.0″ prefWidth=”318.0″ xmlns:fx=”http://javafx.com/fxml/1″ xmlns=”http://javafx.com/javafx/8″> <Button text=”Apples” /> <Button text=”Oranges” /> <Pane HBox.hgrow=”ALWAYS” /> <Button text=”Help” /> </ToolBar>

JavaFX – How to use a method in a controller from another controller?

The “quick and dirty” way is to give the Stage1Controller a reference to the Stage2Controller: public class Stage1Controller { private final Stage2Controller stage2Controller ; public void setStage2Controller(Stage2Controller stage2Controller) { this.stage2Controller = stage2Controller ; } // … @FXML private void handleTranslate (ActionEvent event){ translateFirstStage(); stage2Controller.setLabel(…); } // other code as before … } Now in your … Read more

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