use of com.jfoenix.controls.JFXSnackbar.SnackbarEvent in project JFoenix by jfoenixadmin.
the class IconsController method init.
@PostConstruct
public void init() throws FlowException, VetoException {
bindAction(burger1);
bindAction(burger2);
bindAction(burger3);
bindAction(burger4);
snackbar.registerSnackbarContainer(root);
badge1.setOnMouseClicked((e) -> {
int value = Integer.parseInt(badge1.getText());
if (e.getButton() == MouseButton.PRIMARY) {
value++;
} else if (e.getButton() == MouseButton.SECONDARY) {
value--;
}
if (value == 0) {
badge1.setEnabled(false);
} else {
badge1.setEnabled(true);
}
badge1.setText(String.valueOf(value));
// trigger snackbar
if (count++ % 2 == 0) {
snackbar.fireEvent(new SnackbarEvent("Toast Message " + count));
} else {
if (count % 4 == 0) {
snackbar.fireEvent(new SnackbarEvent("Snackbar Message Persistant " + count, "CLOSE", 3000, true, (b) -> {
snackbar.close();
}));
} else {
snackbar.fireEvent(new SnackbarEvent("Snackbar Message " + count, "UNDO", 3000, false, (b) -> {
}));
}
}
});
}
Aggregations