Adding a graphic to a button

Download javafx eBook

Example

Buttons can have a graphic. graphic can be any JavaFX node, like a ProgressBar

button.setGraphic(new ProgressBar(-1));

An ImageView

button.setGraphic(new ImageView("images/icon.png"));

Or even another button

button.setGraphic(new Button("Nested button"));

Stats

Contributors: 2
2016-08-04
Licensed under: CC-BY-SA

Not affiliated with Stack Overflow
Rip Tutorial: info@zzzprojects.com

Download eBook