Search code examples
javaswingdesktopjtextfieldjprogressbar

How to add text on jprogressbar?


I am using a jprogressbar to indicate the availability status. i want to display a text of 40%[assumption] inside the progressbar. how to do it? the text was changed according to the availability value


Solution

  • You can use:

    Initialising:

    progressBar.setStringPainted(true);
    

    Updating:

    progressBar.setValue(newValue);