Example usage for javax.swing JProgressBar getName

List of usage examples for javax.swing JProgressBar getName

Introduction

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

Prototype

public String getName() 

Source Link

Document

Gets the name of the component.

Usage

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

/**
 * @param val//from   w  w  w .  ja  v  a 2 s  .  c  om
 * 
 * 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()) }));
                    }
                }
            }
        }
    });
}