// Add a helpful graphic to the Cancel Button for clarity.
try {
// Load the JAR-resident Image file into an Image container.
// NOTE: This image comes from ahaSoft, but is copied here as
// otherwise we'd have to pull in outside infrastructure and
// utilities to have access to this icon's usual location.
final Image cancelImage = new Image( "/org/controlsfx/control/Cancel16.png", //$NON-NLS-1$
false );
// Track the Image's error property, to report any errors.
cancelImage.errorProperty().addListener( ( observable, oldValue, imageError ) -> {
if ( imageError ) {
cancelImage.getException().printStackTrace();
}
} );
final ImageView cancelImageView = new ImageView();
cancelImageView.setImage( cancelImage );
cancelImageView.setSmooth( false );
cancelImageView.setCache( true );
cancelButton.setGraphic( cancelImageView );
}
catch ( final Exception e ) {
e.printStackTrace();
}
.
.
.