determinateProgressTransition.fractionProperty().addListener(new ChangeListener<Number>() {
@Override public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) {
StackPane bar = ((StackPane) getSkinnable().lookup(".bar"));
int start = 1 - (int) ((38 * bar.getHeight() / 20) * newValue.doubleValue());
ImagePattern pattern = new ImagePattern(image, start, 0, (38 * bar.getHeight() / 20), bar.getHeight(), false);
BackgroundFill backkgroudFill = new BackgroundFill(pattern, new CornerRadii(0), new Insets(0));
bar.setBackground(new Background(backkgroudFill));
}
});
determinateProgressTransition.play();
}
} else {
StackPane bar = ((StackPane) getSkinnable().lookup(".bar"));
ImagePattern pattern = new ImagePattern(image, 0, 0, (38 * bar.getHeight() / 20), bar.getHeight(), false);
BackgroundFill backkgroudFill = new BackgroundFill(pattern, new CornerRadii(0), new Insets(0));
bar.setBackground(new Background(backkgroudFill));
}
}