I want to handle click on ProgressBar like on slider. and learn a percent of track. I would use slider instead progressbar but it doesn\'t have a highlighted track until th
i solved this problem with code :
progress.setOnMouseClicked(new EventHandler() {
@Override
public void handle(MouseEvent event) {
if (event.getButton() == MouseButton.PRIMARY){
Bounds b1 = progress.getLayoutBounds();
double mouseX = event.getSceneX();
double percent = (((b1.getMinX() + mouseX ) * 100) / b1.getMaxX());
//correcting a percent, i don't know when it need
percent -= 2;
progress.setProgress((percent) / 100);
//do something with progress in percent
}
}
});