Created
April 23, 2013 07:27
-
-
Save npatta01/5441501 to your computer and use it in GitHub Desktop.
Sample Controller.java with string property
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SampleController implements Initializable { | |
// Define the property | |
private StringProperty counter = new SimpleStringProperty(); | |
// Define a getter for the property's value | |
public final String getCounter(){return counter.get();} | |
// Define a setter for the property's value | |
public final void setCounter(String value){counter.set(value);} | |
// Define a getter for the property itself | |
public StringProperty counterProperty() {return counter;} | |
private int val=0; | |
@FXML | |
private void handleButtonAction(ActionEvent event) { | |
System.out.println("You clicked me!"); | |
val=val+1; | |
counter.setValue("Counter:" +val); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment