List of usage examples for javax.swing JProgressBar setVisible
@BeanProperty(hidden = true, visualUpdate = true) public void setVisible(boolean aFlag)
From source file:Main.java
public static void main(String[] arguments) { JPanel panel = new JPanel(new BorderLayout()); JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(panel);/*www. jav a 2 s. c o m*/ frame.setBounds(20, 20, 200, 200); frame.setVisible(true); JProgressBar progressBar = new JProgressBar(); progressBar.setIndeterminate(true); progressBar.setVisible(false); JButton loadButton = new JButton("Load memberlist"); loadButton.setEnabled(true); loadButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { new Thread(new Runnable() { @Override public void run() { progressBar.setVisible(true); // do my stuff here... try { Thread.sleep(2000); } catch (Exception e) { e.printStackTrace(); } progressBar.setVisible(false); } }).start(); } }); JPanel container = new JPanel(new FlowLayout()); container.add(loadButton); container.add(progressBar); panel.add(container); }
From source file:gui_pack.MainGui.java
private void runTestsButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_runTestsButtonActionPerformed int rangeMin, rangeMax, spacing; int passing = 0; {// Beginning of input validation String errorTitle, errorMessage; //make sure at least one sort algorithm is selected if (!(insertionCheckBox.isSelected() || mergeCheckBox.isSelected() || quickCheckBox.isSelected() || selectionCheckBox.isSelected())) { errorTitle = "Selection Error"; errorMessage = "At least one sort algorithm (Insertion Sort, " + "Merge Sort, Quick Sort, or Selection Sort) must be selected."; JOptionPane.showMessageDialog(null, errorMessage, errorTitle, JOptionPane.WARNING_MESSAGE); return; }/* w w w . ja v a 2 s. c om*/ //make sure at least one order is selected if (!(ascendingCheckBox.isSelected() || descendingCheckBox.isSelected() || randomCheckBox.isSelected())) { errorTitle = "Selection Error"; errorMessage = "At least one order (Ascending Order, Descending Order, or Random Order) " + "must be selected."; JOptionPane.showMessageDialog(null, errorMessage, errorTitle, JOptionPane.WARNING_MESSAGE); return; } //make sure all the proper fields contain data try { rangeMin = Integer.parseInt(rangeMinField.getText()); rangeMax = Integer.parseInt(rangeMaxField.getText()); spacing = Integer.parseInt(spacingField.getText()); //for the multithreaded version of this program "iterations" cannot be a variable //this was left in to catch if the iteration field is left blank or has no value if (iterationField.isEnabled()) { Integer.parseInt(iterationField.getText()); } } catch (NumberFormatException arbitraryName) { errorTitle = "Input Error"; if (iterationField.isEnabled()) { errorMessage = "The size, intervals, and iterations fields must contain " + "integer values and only integer values."; } else { errorMessage = "The size and intervals fields must contain " + "integer values and only integer values."; } JOptionPane.showMessageDialog(null, errorMessage, errorTitle, JOptionPane.WARNING_MESSAGE); return; } //make sure field data is appropriate if (rangeMin > rangeMax) { errorTitle = "Range Error"; errorMessage = "Minimum Size must be less than or equal to Maximum Size."; JOptionPane.showMessageDialog(null, errorMessage, errorTitle, JOptionPane.WARNING_MESSAGE); return; } if (spacing < 1 || rangeMin < 1 || rangeMax < 1 || (iterationField.isEnabled() && Integer.parseInt(iterationField.getText()) < 1)) { errorTitle = "Value Error"; if (iterationField.isEnabled()) { errorMessage = "Intervals, sizes, and iterations must be in the positive domain. " + "Spacing, Range(min), Range(max), and Iterations must be greater than or" + " equal to one."; } else { errorMessage = "Intervals and sizes must be in the positive domain. " + "Spacing, Range(min) and Range(max) be greater than or" + " equal to one."; } JOptionPane.showMessageDialog(null, errorMessage, errorTitle, JOptionPane.WARNING_MESSAGE); return; } if (!iterationField.isEnabled()) { passing = 0; } } // End of input validation //here's where we set up a loading bar in case the tests take a while JProgressBar loadBar = new JProgressBar(); JFrame loadFrame = new JFrame(); JLabel displayLabel1 = new JLabel(); loadBar.setIndeterminate(true); loadBar.setVisible(true); displayLabel1.setText("Running large tests, or many tests, using inefficient algorithms \n" + "may take a while. Please be patient."); loadFrame.setLayout(new FlowLayout()); loadFrame.add(loadBar); loadFrame.add(displayLabel1); loadFrame.setSize(600, 100); loadFrame.setTitle("Loading"); loadFrame.setVisible(true); //now we will leave this open until the tests are completed //now we can conduct the actual tests SwingWorker worker = new SwingWorker<XYSeriesCollection, Void>() { XYSeriesCollection results = new XYSeriesCollection(); @Override protected XYSeriesCollection doInBackground() { XYSeries insertSeries = new XYSeries("Insertion Sort"); XYSeries mergeSeries = new XYSeries("Merge Sort"); XYSeries quickSeries = new XYSeries("Quick Sort"); XYSeries selectSeries = new XYSeries("Selection Sort"); final boolean ascending = ascendingCheckBox.isSelected(); final boolean descending = descendingCheckBox.isSelected(); final boolean insertion = insertionCheckBox.isSelected(); final boolean merge = mergeCheckBox.isSelected(); final boolean quick = quickCheckBox.isSelected(); final boolean selection = selectionCheckBox.isSelected(); final int iterations = Integer.parseInt(iterationField.getText()); ListGenerator generator = new ListGenerator(); int[] list; for (int count = rangeMin; count <= rangeMax; count = count + spacing) { if (ascending) { list = generator.ascending(count); if (insertion) { insertSeries.add(count, insertionSort.sort(list)); } if (merge) { mergeSeries.add(count, mergeSort.sort(list)); } if (quick) { quickSeries.add(count, quickSort.sort(list)); } if (selection) { selectSeries.add(count, selectionSort.sort(list)); } } if (descending) { list = generator.descending(count); if (insertion) { insertSeries.add(count, insertionSort.sort(list)); } if (merge) { mergeSeries.add(count, mergeSort.sort(list)); } if (quick) { quickSeries.add(count, quickSort.sort(list)); } if (selection) { selectSeries.add(count, selectionSort.sort(list)); } } for (int iteration = 0; iteration < iterations; iteration++) { list = generator.random(count); if (insertion) { insertSeries.add(count, insertionSort.sort(list)); } if (merge) { mergeSeries.add(count, mergeSort.sort(list)); } if (quick) { quickSeries.add(count, quickSort.sort(list)); } if (selection) { selectSeries.add(count, selectionSort.sort(list)); } } } //now we aggregate the results if (insertion) { results.addSeries(insertSeries); } if (merge) { results.addSeries(mergeSeries); } if (quick) { results.addSeries(quickSeries); } if (selection) { results.addSeries(selectSeries); } return results; } @Override protected void done() { //finally, we display the results JFreeChart chart = ChartFactory.createScatterPlot("SortExplorer", // chart title "List Size", // x axis label "Number of Comparisons", // y axis label results, // data PlotOrientation.VERTICAL, true, // include legend true, // tooltips false // urls ); ChartFrame frame = new ChartFrame("First", chart); frame.pack(); frame.setVisible(true); loadFrame.setVisible(false); } }; //having set up the multithreading 'worker' we can finally conduct the //test worker.execute(); }
From source file:marytts.tools.voiceimport.DatabaseImportMain.java
/** * Run the selected components in a different thread. * *//* w w w. j a va 2s .co m*/ protected void runSelectedComponents() { new Thread("RunSelectedComponentsThread") { public void run() { try { runButton.setEnabled(false); for (int i = 0; i < components.length; i++) { if (checkboxes[i].isSelected()) { boolean success = false; Container parent = checkboxes[i].getParent(); final JProgressBar progress = new JProgressBar(); final VoiceImportComponent oneComponent = components[i]; if (oneComponent.getProgress() != -1) { progress.setStringPainted(true); new Thread("ProgressThread") { public void run() { int percent = 0; while (progress.isVisible()) { progress.setValue(percent); try { Thread.sleep(500); } catch (InterruptedException ie) { } percent = oneComponent.getProgress(); } } }.start(); } else { progress.setIndeterminate(true); } parent.add(progress, BorderLayout.EAST); progress.setVisible(true); parent.validate(); try { success = oneComponent.compute(); } catch (Exception exc) { checkboxes[i].setBackground(Color.RED); throw new Exception("The component " + checkboxes[i].getText() + " produced the following exception: ", exc); } finally { checkboxes[i].setSelected(false); progress.setVisible(false); } if (success) { checkboxes[i].setBackground(Color.GREEN); } else { checkboxes[i].setBackground(Color.RED); } } } } catch (Throwable e) { e.printStackTrace(); } finally { runButton.setEnabled(true); } } }.start(); }
From source file:eu.apenet.dpt.standalone.gui.batch.ConvertAndValidateActionListener.java
public void actionPerformed(ActionEvent event) { labels = dataPreparationToolGUI.getLabels(); continueLoop = true;//ww w . ja va 2 s . c om dataPreparationToolGUI.disableAllBtnAndItems(); dataPreparationToolGUI.disableEditionTab(); dataPreparationToolGUI.disableRadioButtons(); dataPreparationToolGUI.disableAllBatchBtns(); dataPreparationToolGUI.getAPEPanel().setFilename(""); final Object[] objects = dataPreparationToolGUI.getXmlEadList().getSelectedValues(); final ApexActionListener apexActionListener = this; new Thread(new Runnable() { public void run() { FileInstance uniqueFileInstance = null; String uniqueXslMessage = ""; int numberOfFiles = objects.length; int currentFileNumberBatch = 0; ProgressFrame progressFrame = new ProgressFrame(labels, parent, true, false, apexActionListener); JProgressBar batchProgressBar = progressFrame.getProgressBarBatch(); dataPreparationToolGUI.getAPEPanel().getApeTabbedPane().disableConversionBtn(); dataPreparationToolGUI.getAPEPanel().getApeTabbedPane().disableValidationBtn(); dataPreparationToolGUI.getAPEPanel().getApeTabbedPane().disableConvertAndValidateBtn(); dataPreparationToolGUI.getXmlEadList().setEnabled(false); for (Object oneFile : objects) { if (!continueLoop) { break; } File file = (File) oneFile; FileInstance fileInstance = dataPreparationToolGUI.getFileInstances().get(file.getName()); if (numberOfFiles == 1) { uniqueFileInstance = fileInstance; } if (!fileInstance.isXml()) { fileInstance.setXml(XmlChecker.isXmlParseable(file) == null); if (!fileInstance.isXml()) { if (type == CONVERT || type == CONVERT_AND_VALIDATE) { fileInstance.setConversionErrors(labels.getString("conversion.error.fileNotXml")); } else if (type == VALIDATE || type == CONVERT_AND_VALIDATE) { fileInstance.setValidationErrors(labels.getString("validation.error.fileNotXml")); } dataPreparationToolGUI.enableSaveBtn(); dataPreparationToolGUI.enableRadioButtons(); dataPreparationToolGUI.enableEditionTab(); } } SummaryWorking summaryWorking = new SummaryWorking(dataPreparationToolGUI.getResultArea(), batchProgressBar); summaryWorking.setTotalNumberFiles(numberOfFiles); summaryWorking.setCurrentFileNumberBatch(currentFileNumberBatch); Thread threadRunner = new Thread(summaryWorking); threadRunner.setName(SummaryWorking.class.toString()); threadRunner.start(); JProgressBar progressBar = null; Thread threadProgress = null; CounterThread counterThread = null; CounterCLevelCall counterCLevelCall = null; if (fileInstance.isXml()) { currentFileNumberBatch = currentFileNumberBatch + 1; if (type == CONVERT || type == CONVERT_AND_VALIDATE) { dataPreparationToolGUI.setResultAreaText(labels.getString("converting") + " " + file.getName() + " (" + (currentFileNumberBatch) + "/" + numberOfFiles + ")"); String eadid = ""; boolean doTransformation = true; if (fileInstance.getValidationSchema() .equals(Utilities.getXsdObjectFromPath(Xsd_enum.XSD_APE_SCHEMA.getPath())) || fileInstance.getValidationSchema().equals( Utilities.getXsdObjectFromPath(Xsd_enum.XSD_EAD_SCHEMA.getPath()))) { StaxTransformationTool staxTransformationTool = new StaxTransformationTool(file); staxTransformationTool.run(); LOG.debug("file has eadid? " + staxTransformationTool.isFileWithEadid()); if (!staxTransformationTool.isFileWithEadid()) { EadidQueryComponent eadidQueryComponent; if (staxTransformationTool.getUnitid() != null && !staxTransformationTool.getUnitid().equals("")) { eadidQueryComponent = new EadidQueryComponent( staxTransformationTool.getUnitid()); } else { eadidQueryComponent = new EadidQueryComponent(labels); } int result = JOptionPane.showConfirmDialog(parent, eadidQueryComponent.getMainPanel(), labels.getString("enterEADID"), JOptionPane.OK_CANCEL_OPTION); while (StringUtils.isEmpty(eadidQueryComponent.getEntryEadid()) && result != JOptionPane.CANCEL_OPTION) { result = JOptionPane.showConfirmDialog(parent, eadidQueryComponent.getMainPanel(), labels.getString("enterEADID"), JOptionPane.OK_CANCEL_OPTION); } if (result == JOptionPane.OK_OPTION) { eadid = eadidQueryComponent.getEntryEadid(); } else if (result == JOptionPane.CANCEL_OPTION) { doTransformation = false; } } } if (doTransformation) { int counterMax = 0; if (fileInstance.getConversionScriptName() .equals(Utilities.XSL_DEFAULT_APEEAD_NAME)) { progressBar = progressFrame.getProgressBarSingle(); progressBar.setVisible(true); progressFrame .setTitle(labels.getString("progressTrans") + " - " + file.getName()); CountCLevels countCLevels = new CountCLevels(); counterMax = countCLevels.countOneFile(file); if (counterMax > 0) { counterCLevelCall = new CounterCLevelCall(); counterCLevelCall.initializeCounter(counterMax); counterThread = new CounterThread(counterCLevelCall, progressBar, counterMax); threadProgress = new Thread(counterThread); threadProgress.setName(CounterThread.class.toString()); threadProgress.start(); } } try { try { File xslFile = new File(fileInstance.getConversionScriptPath()); File outputFile = new File(Utilities.TEMP_DIR + "temp_" + file.getName()); outputFile.deleteOnExit(); StringWriter xslMessages; HashMap<String, String> parameters = dataPreparationToolGUI.getParams(); parameters.put("eadidmissing", eadid); CheckIsEadFile checkIsEadFile = new CheckIsEadFile(file); checkIsEadFile.run(); if (checkIsEadFile.isEadRoot()) { File outputFile_temp = new File( Utilities.TEMP_DIR + ".temp_" + file.getName()); TransformationTool.createTransformation(FileUtils.openInputStream(file), outputFile_temp, Utilities.BEFORE_XSL_FILE, null, true, true, null, true, null); xslMessages = TransformationTool.createTransformation( FileUtils.openInputStream(outputFile_temp), outputFile, xslFile, parameters, true, true, null, true, counterCLevelCall); outputFile_temp.delete(); } else { xslMessages = TransformationTool.createTransformation( FileUtils.openInputStream(file), outputFile, xslFile, parameters, true, true, null, true, null); } fileInstance.setConversionErrors(xslMessages.toString()); fileInstance .setCurrentLocation(Utilities.TEMP_DIR + "temp_" + file.getName()); fileInstance.setConverted(); fileInstance.setLastOperation(FileInstance.Operation.CONVERT); uniqueXslMessage = xslMessages.toString(); if (xslMessages.toString().equals("")) { if (fileInstance.getConversionScriptName() .equals(Utilities.XSL_DEFAULT_APEEAD_NAME)) { fileInstance.setConversionErrors( labels.getString("conversion.noExcludedElements")); } else { fileInstance.setConversionErrors( labels.getString("conversion.finished")); } } if (!continueLoop) { break; } } catch (Exception e) { fileInstance.setConversionErrors(labels.getString("conversionException") + "\r\n\r\n-------------\r\n" + e.getMessage()); throw new Exception("Error when converting " + file.getName(), e); } if (threadProgress != null) { counterThread.stop(); threadProgress.interrupt(); } if (progressBar != null) { if (counterMax > 0) { progressBar.setValue(counterMax); } progressBar.setIndeterminate(true); } } catch (Exception e) { LOG.error("Error when converting and validating", e); } finally { summaryWorking.stop(); threadRunner.interrupt(); dataPreparationToolGUI.getXmlEadListLabel().repaint(); dataPreparationToolGUI.getXmlEadList().repaint(); if (progressBar != null) { progressBar.setVisible(false); } } } if (numberOfFiles == 1) { uniqueFileInstance = fileInstance; } } if (type == VALIDATE || type == CONVERT_AND_VALIDATE) { try { try { File fileToValidate = new File(fileInstance.getCurrentLocation()); InputStream is = FileUtils.openInputStream(fileToValidate); dataPreparationToolGUI .setResultAreaText(labels.getString("validating") + " " + file.getName() + " (" + currentFileNumberBatch + "/" + numberOfFiles + ")"); XsdObject xsdObject = fileInstance.getValidationSchema(); List<SAXParseException> exceptions; if (xsdObject.getName().equals(Xsd_enum.DTD_EAD_2002.getReadableName())) { exceptions = DocumentValidation.xmlValidationAgainstDtd( fileToValidate.getAbsolutePath(), Utilities.getUrlPathXsd(xsdObject)); } else { exceptions = DocumentValidation.xmlValidation(is, Utilities.getUrlPathXsd(xsdObject), xsdObject.isXsd11()); } if (exceptions == null || exceptions.isEmpty()) { fileInstance.setValid(true); fileInstance.setValidationErrors(labels.getString("validationSuccess")); if (xsdObject.getFileType().equals(FileInstance.FileType.EAD) && xsdObject.getName().equals("apeEAD")) { XmlQualityCheckerCall xmlQualityCheckerCall = new XmlQualityCheckerCall(); InputStream is2 = FileUtils .openInputStream(new File(fileInstance.getCurrentLocation())); TransformationTool.createTransformation(is2, null, Utilities.XML_QUALITY_FILE, null, true, true, null, false, xmlQualityCheckerCall); String xmlQualityStr = createXmlQualityString(xmlQualityCheckerCall); fileInstance.setValidationErrors( fileInstance.getValidationErrors() + xmlQualityStr); fileInstance.setXmlQualityErrors( createXmlQualityErrors(xmlQualityCheckerCall)); } } else { String errors = Utilities.stringFromList(exceptions); fileInstance.setValidationErrors(errors); fileInstance.setValid(false); } fileInstance.setLastOperation(FileInstance.Operation.VALIDATE); } catch (Exception ex) { fileInstance.setValid(false); fileInstance.setValidationErrors(labels.getString("validationException") + "\r\n\r\n-------------\r\n" + ex.getMessage()); throw new Exception("Error when validating", ex); } } catch (Exception e) { LOG.error("Error when validating", e); } finally { summaryWorking.stop(); threadRunner.interrupt(); dataPreparationToolGUI.getXmlEadListLabel().repaint(); dataPreparationToolGUI.getXmlEadList().repaint(); if (progressBar != null) { progressBar.setVisible(false); } } if (numberOfFiles == 1) { uniqueFileInstance = fileInstance; } } } } Toolkit.getDefaultToolkit().beep(); if (progressFrame != null) { try { progressFrame.stop(); } catch (Exception e) { LOG.error("Error when stopping the progress bar", e); } } dataPreparationToolGUI.getFinalAct().run(); if (numberOfFiles > 1) { dataPreparationToolGUI.getXmlEadList().clearSelection(); } else if (uniqueFileInstance != null) { if (type != VALIDATE) { dataPreparationToolGUI.getAPEPanel().getApeTabbedPane() .setConversionErrorText(replaceGtAndLt(uniqueFileInstance.getConversionErrors())); if (uniqueXslMessage.equals("")) { dataPreparationToolGUI.getAPEPanel().getApeTabbedPane() .checkFlashingTab(APETabbedPane.TAB_CONVERSION, Utilities.FLASHING_GREEN_COLOR); } else { dataPreparationToolGUI.getAPEPanel().getApeTabbedPane() .checkFlashingTab(APETabbedPane.TAB_CONVERSION, Utilities.FLASHING_RED_COLOR); } } if (type != CONVERT) { dataPreparationToolGUI.getAPEPanel().getApeTabbedPane() .setValidationErrorText(uniqueFileInstance.getValidationErrors()); if (uniqueFileInstance.isValid()) { dataPreparationToolGUI.getAPEPanel().getApeTabbedPane() .checkFlashingTab(APETabbedPane.TAB_VALIDATION, Utilities.FLASHING_GREEN_COLOR); if (uniqueFileInstance.getValidationSchema() .equals(Utilities.getXsdObjectFromPath(Xsd_enum.XSD_APE_SCHEMA.getPath()))) { dataPreparationToolGUI.getAPEPanel().getApeTabbedPane().enableConversionEdmBtn(); dataPreparationToolGUI.getAPEPanel().getApeTabbedPane().enableValidationReportBtn(); } else if (uniqueFileInstance.getValidationSchema() .equals(Utilities.getXsdObjectFromPath(Xsd_enum.XSD_EAD_SCHEMA.getPath())) || uniqueFileInstance.getValidationSchema() .equals(Utilities.getXsdObjectFromPath(Xsd_enum.DTD_EAD_2002.getPath())) || uniqueFileInstance.getValidationSchema().equals( Utilities.getXsdObjectFromPath(Xsd_enum.XSD_EAC_SCHEMA.getPath()))) { dataPreparationToolGUI.getAPEPanel().getApeTabbedPane().enableConversionBtn(); // dataPreparationToolGUI.getAPEPanel().getApeTabbedPane().enableValidationReportBtn(); } } else { dataPreparationToolGUI.getAPEPanel().getApeTabbedPane() .checkFlashingTab(APETabbedPane.TAB_VALIDATION, Utilities.FLASHING_RED_COLOR); if (uniqueFileInstance.getValidationSchema() .equals(Utilities.getXsdObjectFromPath(Xsd_enum.XSD_APE_SCHEMA.getPath())) || uniqueFileInstance.getValidationSchema().equals( Utilities.getXsdObjectFromPath(Xsd_enum.XSD_EAD_SCHEMA.getPath())) || uniqueFileInstance.getValidationSchema() .equals(Utilities.getXsdObjectFromPath(Xsd_enum.DTD_EAD_2002.getPath())) || uniqueFileInstance.getValidationSchema().equals( Utilities.getXsdObjectFromPath(Xsd_enum.XSD_APE_EAC_SCHEMA.getPath())) || uniqueFileInstance.getValidationSchema().equals( Utilities.getXsdObjectFromPath(Xsd_enum.XSD_EAC_SCHEMA.getPath()))) { dataPreparationToolGUI.enableConversionBtns(); dataPreparationToolGUI.getAPEPanel().getApeTabbedPane() .enableConvertAndValidateBtn(); } } } dataPreparationToolGUI.enableMessageReportBtns(); } if (continueLoop) { dataPreparationToolGUI.setResultAreaText(labels.getString("finished")); } else { dataPreparationToolGUI.setResultAreaText(labels.getString("aborted")); } dataPreparationToolGUI.enableSaveBtn(); if (type == CONVERT) { dataPreparationToolGUI.enableValidationBtns(); } dataPreparationToolGUI.enableRadioButtons(); dataPreparationToolGUI.enableEditionTab(); } }).start(); }
From source file:edu.ku.brc.specify.tasks.subpane.wb.wbuploader.Uploader.java
/** * @param min//from w w w . ja va2s . co m * @param max * @param paintString - true if the progress bar should display string description of progress * @param itemName - string description will be: "itemName x of max" (using English resource). * * Initializes progress bar for upload actions. If min and max = 0, sets progress bar is * indeterminate. */ protected void initProgressBar(final int min, final int max, final boolean paintString, final String itemName, final boolean useAppProgress) { SwingUtilities.invokeLater(new Runnable() { public void run() { if (!useAppStatBar && mainPanel == null) { log.error("UI does not exist."); return; } minProgVal = min; maxProgVal = max; indeterminateProgress = minProgVal == 0 && maxProgVal == 0; useAppStatBar = useAppProgress; if (useAppStatBar) { if (indeterminateProgress) { UIRegistry.getStatusBar().setIndeterminate("UPLOADER", indeterminateProgress); } else { UIRegistry.getStatusBar().setProgressRange("UPLOADER", minProgVal, maxProgVal); } } else { JProgressBar pb = mainPanel.getCurrOpProgress(); pb.setVisible(true); if (indeterminateProgress) { pb.setIndeterminate(true); pb.setString(""); } else { if (pb.isIndeterminate()) { pb.setIndeterminate(false); } pb.setStringPainted(paintString); if (paintString) { pb.setName(itemName); } pb.setMinimum(minProgVal); pb.setMaximum(maxProgVal); pb.setValue(minProgVal); } } } }); }