Reputation: 31
This is the "console" version of what I want to do:
String aboutMe;
aboutMe = "bla bla bla";
System.out.println(aboutMe);
and in JavaFX I have this:
in x.fxml:
<Label GridPane.rowIndex="1" fx:id="about"/>
in Controller.java:
public String aboutMe = "Bla bla";
public Label about;
I would like to just use "text=aboutMe" in fmxl...but that's not working.
using
public label about = new Label(aboutMe);
...isn't working either.
if I had a contructor I could do:
public Controller() {
about.setText(aboutMe);
}
But I don't.
Any one have any ideas?
Upvotes: 1
Views: 1146
Reputation: 31
I got it to work using this:
public class Controller implements Initializable {
public void initialize(URL location, ResourceBundle resources) {
about.setText(aboutMe);
}
}
Upvotes: 2