Example usage for javax.swing JProgressBar isStringPainted

List of usage examples for javax.swing JProgressBar isStringPainted

Introduction

In this page you can find the example usage for javax.swing JProgressBar isStringPainted.

Prototype

public boolean isStringPainted() 

Source Link

Document

Returns the value of the stringPainted property.

Usage

From source file:Main.java

public static void main(String[] argv) throws Exception {
    int minimum = 0;
    int maximum = 100;
    JProgressBar progress = new JProgressBar(minimum, maximum);
    progress.setOrientation(SwingConstants.HORIZONTAL);
    int newValue = 33;
    progress.setValue(newValue);/*w w  w .j a  v a 2  s . c om*/

    System.out.println(progress.isStringPainted());
}

From source file:edu.ku.brc.specify.tasks.subpane.wb.wbuploader.Uploader.java

/**
 * @param val/* w  ww .  j  a  v  a 2 s  .  co  m*/
 * 
 * Sets progress bar progress.
 */
protected void setCurrentOpProgress(final int val) {
    SwingUtilities.invokeLater(new Runnable() {
        public void run() {

            if (mainPanel == null && !useAppStatBar) {
                log.error("UI does not exist.");
                return;
            }
            if (!indeterminateProgress) {
                if (useAppStatBar && !indeterminateProgress) {
                    if (val == -1) {
                        UIRegistry.getStatusBar().incrementValue("UPLOADER");
                    } else {
                        UIRegistry.getStatusBar().setValue("UPLOADER", val);
                    }
                } else {
                    JProgressBar pb = mainPanel.getCurrOpProgress();
                    int newVal = val == -1 ? Math.min(pb.getValue() + 1, pb.getMaximum()) : val;
                    pb.setValue(newVal);
                    if (pb.isStringPainted()) {
                        pb.setString(String.format(getResourceString("WB_UPLOAD_PROGRESSBAR_TEXT"),
                                new Object[] { pb.getName(), Integer.toString(newVal),
                                        Integer.toString(pb.getMaximum()) }));
                    }
                }
            }
        }
    });
}