JavaFX 2.2 - Hiding percentage of progressIndicator indicator in ListCell

I have a ListCell in which I display information on the progress of downloading a ProgressIndicator file.

My problem is to remove the percentage information displayed below the indicator. As stated here , I included the rule in my css as follows:

.customProgressIndicator .percentage{
    visibility: hidden;
    -fx-text-background-color: red;
}

The part -fx-text-background-color: redis just to make sure our css is applied to node.

The problem is that I am making a type call indicator.setProgress(progress), the percentage becomes visible (red), and when I hover over the indicator, it becomes invisible again. Again at the end, the text β€œFinish” becomes visible below when called indicator.setProgress(1.0)and again becomes invisible after freezing.

It may be associated with ListView, because; after hovering and invisibility, if I remove the item from Listand call updateItemon ListCell, it will become visible again.

I tried a workaround like:

    Text text = (Text)indicator.lookup(".percentage");
    if ( text != null )
    {
        text.setText("");
    }

But text sometimes null, sometimes not.

+5
source share
1 answer

Notes:

1) I read the message you linked, and the OP implicitly confirms that it visibility: hidden;works for him / her. But I tested the same code and it does not work. Perhaps due to differences in version. I dont know.

2) is -fx-text-background-colornot a CSS property. This is the predefined color in caspian.css. Therefore, by changing it, you implicitly change the color of the percentage mark set by default in

.progress-indicator .percentage {
    -fx-font-size: 0.916667em; /* 11pt - 1 less than the default font */
    -fx-fill: -fx-text-background-color;
}

caspian.css. (Note the -fx-text-background-colorabove)

3) , , ,

.customProgressIndicator .percentage {
    -fx-fill: null;
}

P.S. .

+10

All Articles