Created
May 31, 2018 23:31
-
-
Save diogocapela/22cb892bfc211e3bb5a622e058bc02c2 to your computer and use it in GitHub Desktop.
JavaFX UI methods example
This file contains hidden or 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
// Updating a JavaFX table when UI loads example | |
private void updateView() { | |
col1.setCellValueFactory(new PropertyValueFactory<>("id")); | |
col2.setCellValueFactory(new PropertyValueFactory<>("username")); | |
col3.setCellValueFactory(new PropertyValueFactory<>("email")); | |
col4.setCellValueFactory(new PropertyValueFactory<>("password")); | |
table.setItems(FXCollections.observableArrayList( | |
system.getUserRegistry() | |
)); | |
} | |
// Adding a user on a JavaFX button click example | |
@FXML | |
protected void hanldeAddUser() { | |
system.addUser(new User( | |
Integer.parseInt(id.getText()), | |
username.getText(), | |
email.getText(), | |
password.getText() | |
)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment