List of usage examples for javax.swing JOptionPane YES_NO_OPTION
int YES_NO_OPTION
To view the source code for javax.swing JOptionPane YES_NO_OPTION.
Click Source Link
showConfirmDialog
. From source file:com.a544jh.kanamemory.ui.ProfileChooserPanel.java
private void deleteButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteButtonActionPerformed if (JOptionPane.showConfirmDialog(this, "Are you sure?", "Delete Profile", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.YES_OPTION) { JsonFileWriter.deleteProfile((String) profilesList.getSelectedValue(), "profiles"); populateList();//w w w . ja v a2 s . c o m } }
From source file:edu.ku.brc.af.auth.UserAndMasterPasswordMgr.java
/** * @return//w w w .j av a2 s . c om */ protected int askToContForCredentials() { int userChoice = JOptionPane.NO_OPTION; Object[] options = { getResourceString("Continue"), //$NON-NLS-1$ getResourceString("CANCEL") //$NON-NLS-1$ }; loadAndPushResourceBundle("masterusrpwd"); userChoice = JOptionPane.showOptionDialog(UIRegistry.getTopWindow(), getLocalizedMessage("MISSING_CREDS", usersUserName), //$NON-NLS-1$ getResourceString("MISSING_CREDS_TITLE"), //$NON-NLS-1$ JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[0]); popResourceBundle(); return userChoice; }
From source file:edu.ku.brc.services.biogeomancer.GeoCoordBGMProvider.java
public void processGeoRefData(final List<GeoCoordDataIFace> items, final GeoCoordProviderListenerIFace listenerArg, final String helpContextArg) { this.listener = listenerArg; this.helpContext = helpContextArg; UsageTracker.incrUsageCount("Tools.BioGeomancerData"); //$NON-NLS-1$ log.info("Performing BioGeomancer lookup of selected records"); //$NON-NLS-1$ // create a progress bar dialog to show the network progress final ProgressDialog progressDialog = new ProgressDialog( UIRegistry.getResourceString("GeoCoordBGMProvider.BIOGEOMANCER_PROGRESS"), false, true); // I18N //$NON-NLS-1$ progressDialog.getCloseBtn().setText(getResourceString("CANCEL")); //$NON-NLS-1$ progressDialog.setModal(true);//w w w .j av a 2s .co m progressDialog.setProcess(0, items.size()); // XXX Java 6 //progressDialog.setIconImage( IconManager.getImage("AppIcon").getImage()); // use a SwingWorker thread to do all of the work, and update the GUI when done final SwingWorker bgTask = new SwingWorker() { final JStatusBar statusBar = UIRegistry.getStatusBar(); protected boolean cancelled = false; @Override public void interrupt() { super.interrupt(); cancelled = true; } @SuppressWarnings("synthetic-access") //$NON-NLS-1$ @Override public Object construct() { // perform the BG web service call ON all rows, storing results in the rows int progress = 0; for (GeoCoordDataIFace item : items) { if (cancelled) { break; } // get the locality data String localityNameStr = item.getLocalityString(); // get the geography data String country = item.getCountry(); String state = item.getState(); String county = item.getCounty(); log.info("Making call to BioGeomancer service: " + localityNameStr); //$NON-NLS-1$ String bgResults; BioGeomancerQuerySummaryStruct bgQuerySummary; try { bgResults = BioGeomancer.getBioGeomancerResponse(item.getGeoCoordId().toString(), country, state, county, localityNameStr); bgQuerySummary = BioGeomancer.parseBioGeomancerResponse(bgResults); } catch (IOException ex1) { String warning = getResourceString("GeoCoordBGMProvider.WB_BIOGEOMANCER_UNAVAILABLE"); //$NON-NLS-1$ statusBar.setWarningMessage(warning, ex1); log.error("A network error occurred while contacting the BioGeomancer service", ex1); //$NON-NLS-1$ // update the progress bar UI and move on progressDialog.setProcess(++progress); continue; } catch (Exception ex2) { UsageTracker.incrHandledUsageCount(); edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(GeoCoordBGMProvider.class, ex2); // right now we'll simply blame this on BG // in the future we might get more specific about this error String warning = getResourceString("GeoCoordBGMProvider.WB_BIOGEOMANCER_UNAVAILABLE"); //$NON-NLS-1$ statusBar.setWarningMessage(warning, ex2); log.warn("Failed to get result count from BioGeomancer respsonse", ex2); //$NON-NLS-1$ // update the progress bar UI and move on progressDialog.setProcess(++progress); continue; } // if there was at least one result, pre-cache a map for that result int resCount = bgQuerySummary.results.length; if (resCount > 0) { final int rowNumber = item.getGeoCoordId(); final BioGeomancerQuerySummaryStruct summaryStruct = bgQuerySummary; // create a thread to go grab the map so it will be cached for later use Thread t = new Thread(new Runnable() { public void run() { try { log.info("Requesting map of BioGeomancer results for workbench row " //$NON-NLS-1$ + rowNumber); BioGeomancer.getMapOfQuerySummary(summaryStruct, null); } catch (Exception e) { UsageTracker.incrHandledUsageCount(); edu.ku.brc.exceptions.ExceptionTracker.getInstance() .capture(GeoCoordBGMProvider.class, e); log.warn("Failed to pre-cache BioGeomancer results map", e); //$NON-NLS-1$ } } }); t.setName("Map Pre-Caching Thread: row " + item.getGeoCoordId()); // I18N //$NON-NLS-1$ log.debug("Starting map pre-caching thread"); //$NON-NLS-1$ t.start(); } // if we got at least one result... if (resCount > 0) { item.setXML(bgResults); } // update the progress bar UI and move on progressDialog.setProcess(++progress); } return null; } @Override public void finished() { statusBar.setText(getResourceString("GeoCoordBGMProvider.BIOGEOMANCER_COMPLETED")); //$NON-NLS-1$ if (!cancelled) { // hide the progress dialog progressDialog.setVisible(false); // find out how many records actually had results List<GeoCoordDataIFace> rowsWithResults = new Vector<GeoCoordDataIFace>(); for (GeoCoordDataIFace row : items) { if (row.getXML() != null) { rowsWithResults.add(row); } } // if no records had possible results... int numRecordsWithResults = rowsWithResults.size(); if (numRecordsWithResults == 0) { statusBar.setText(getResourceString("GeoCoordBGMProvider.NO_BG_RESULTS")); //$NON-NLS-1$ JOptionPane.showMessageDialog(UIRegistry.getTopWindow(), getResourceString("GeoCoordBGMProvider.NO_BG_RESULTS"), getResourceString("NO_RESULTS"), JOptionPane.INFORMATION_MESSAGE); return; } if (listener != null) { listener.aboutToDisplayResults(); } // ask the user if they want to review the results String message = String.format( getResourceString("GeoCoordBGMProvider.BGM_VIEW_RESULTS_CONFIRM"), //$NON-NLS-1$ String.valueOf(numRecordsWithResults)); int userChoice = JOptionPane.showConfirmDialog(UIRegistry.getTopWindow(), message, getResourceString("GeoCoordBGMProvider.CONTINUE"), JOptionPane.YES_NO_OPTION);//$NON-NLS-1$ if (userChoice != JOptionPane.YES_OPTION) { statusBar.setText(getResourceString("GeoCoordBGMProvider.BIOGEOMANCER_TERMINATED")); //$NON-NLS-1$ return; } displayBioGeomancerResults(rowsWithResults); } } }; // if the user hits close, stop the worker thread progressDialog.getCloseBtn().addActionListener(new ActionListener() { @SuppressWarnings("synthetic-access") //$NON-NLS-1$ public void actionPerformed(ActionEvent ae) { log.debug("Stopping the BioGeomancer service worker thread"); //$NON-NLS-1$ bgTask.interrupt(); } }); log.debug("Starting the BioGeomancer service worker thread"); //$NON-NLS-1$ bgTask.start(); UIHelper.centerAndShow(progressDialog); }
From source file:org.jfree.chart.demo.JFreeChartDemo.java
/** * Exits the application, but only if the user agrees. *///from w ww. j a v a2 s.co m private void attemptExit() { final String title = this.resources.getString("dialog.exit.title"); final String message = this.resources.getString("dialog.exit.message"); final int result = JOptionPane.showConfirmDialog(this, message, title, JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (result == JOptionPane.YES_OPTION) { dispose(); System.exit(0); } }
From source file:es.emergya.ui.plugins.AdminPanel.java
@Override public void actionPerformed(ActionEvent e) { String cmd = e.getActionCommand(); if (cmd.indexOf("Seleccionar Tod") == 0) { for (int i = 0; i < table.getRowCount(); i++) { table.getModel().setValueAt(Boolean.TRUE, i, 0); }// w w w . j a v a 2 s . co m } else if (cmd.indexOf("Deseleccionar Tod") == 0) { for (int i = 0; i < table.getRowCount(); i++) { table.getModel().setValueAt(Boolean.FALSE, i, 0); } } else if (cmd.indexOf("Eliminar Seleccionad") == 0) { boolean alguno = false; for (int i = table.getRowCount() - 1; i >= 0 && !alguno; i--) { if ((Boolean) table.getModel().getValueAt(i, 0)) { alguno = true; } } if (!alguno) { return; } if (JOptionPane.showConfirmDialog(this, "Buttons.delete.confirm", "Selecciona una opcin", JOptionPane.YES_NO_OPTION) != JOptionPane.YES_OPTION) { return; } Vector<Object> fail = new Vector<Object>(); int total = 0; for (int i = table.getRowCount() - 1; i >= 0; i--) { if ((Boolean) table.getModel().getValueAt(i, 0)) { DeleteAction a = (DeleteAction) ((JButton) table.getValueAt(i, table.getColumnCount() - 1)) .getAction(); total++; if (!a.delete(false)) { fail.add(table.getValueAt(i, 1)); } } } if (this.father != null) { this.father.refresh(null); PluginEventHandler.fireChange(this.father); } if (total == 0) { JOptionPane.showMessageDialog(this, "No hay elementos seleccionados para eliminar.", null, JOptionPane.ERROR_MESSAGE); } if (fail.size() > 0) { JOptionPane.showMessageDialog(this, errorString + ":\n" + fail.toString() + "\n" + errorCause, null, JOptionPane.ERROR_MESSAGE); } } else log.error("Comando no encontrado: " + cmd); }
From source file:me.ryandowling.allmightybot.AllmightyBot.java
public AllmightyBot() { if (Files.exists(Utils.getSettingsFile())) { try {//from w ww . j a va 2s .c o m this.settings = GSON.fromJson(FileUtils.readFileToString(Utils.getSettingsFile().toFile()), Settings.class); } catch (IOException e) { e.printStackTrace(); } } else { this.settings = new Settings(); } if (!this.settings.hasInitialSetupBeenCompleted()) { String input = null; input = JOptionPane.showInputDialog(null, "Please enter the username of the Twitch user " + "to act " + "as the bot", "Twitch Username", JOptionPane.QUESTION_MESSAGE); if (input == null) { logger.error("Failed to input proper things when setting up! Do it properly next time!"); System.exit(0); } settings.setTwitchUsername(input); input = JOptionPane.showInputDialog(null, "Please enter the IRC oauth token of the Twitch user " + "acting as the bot", "Twitch Token", JOptionPane.QUESTION_MESSAGE); if (input == null) { logger.error("Failed to input proper things when setting up! Do it properly next time!"); System.exit(0); } settings.setTwitchToken(input); input = JOptionPane.showInputDialog(null, "Please enter the API token of the Twitch user " + "acting " + "as the bot", "Twitch API Token", JOptionPane.QUESTION_MESSAGE); if (input == null) { logger.error("Failed to input proper things when setting up! Do it properly next time!"); System.exit(0); } settings.setTwitchApiToken(input); input = JOptionPane.showInputDialog(null, "Please enter the API client ID of the application using " + "the Twitch API", "Twitch API Client ID", JOptionPane.QUESTION_MESSAGE); if (input == null) { logger.error("Failed to input proper things when setting up! Do it properly next time!"); System.exit(0); } settings.setTwitchApiClientID(input); input = JOptionPane.showInputDialog(null, "Please enter the username of the Twitch user whose " + "channel you wish to join! Must be in all lowercase", "User To Join", JOptionPane.QUESTION_MESSAGE); if (input == null) { logger.error("Failed to input proper things when setting up! Do it properly next time!"); System.exit(0); } settings.setTwitchChannel(input); input = JOptionPane.showInputDialog(null, "Please enter the name of the caster to display when " + "referencing them", "Casters Name", JOptionPane.QUESTION_MESSAGE); if (input == null) { logger.error("Failed to input proper things when setting up! Do it properly next time!"); System.exit(0); } settings.setCastersName(input); input = JOptionPane.showInputDialog(null, "How often do you want to run the timed messages (in " + "minutes)?", "Timed Messages", JOptionPane.QUESTION_MESSAGE); try { settings.setTimedMessagesInterval(Integer.parseInt(input) * 60); } catch (NumberFormatException e) { input = null; } input = JOptionPane.showInputDialog(null, "How long do you want to time people out for when they post " + "links after 1 warning (in minutes)?", "Spam Timeouts", JOptionPane.QUESTION_MESSAGE); try { settings.setLinkTimeoutLength1(Integer.parseInt(input) * 60); } catch (NumberFormatException e) { input = null; } input = JOptionPane.showInputDialog(null, "How long do you want to time people out for when they post " + "links after 2 and more warnings (in minutes)?", "Spam Timeouts", JOptionPane.QUESTION_MESSAGE); try { settings.setLinkTimeoutLength2(Integer.parseInt(input) * 60); } catch (NumberFormatException e) { input = null; } if (input == null) { logger.error("Failed to input proper things when setting up! Do it properly next time!"); System.exit(0); } int reply = JOptionPane.showConfirmDialog(null, "Do you want the bot to announce itself on join " + "(message " + "customisable in the lang.json file after startup)?", "Self Announce", JOptionPane.YES_NO_OPTION); if (reply != JOptionPane.YES_OPTION) { settings.setAnnounceOnJoin(false); } this.settings.initialSetupComplete(); this.firstTime = true; } }
From source file:jhplot.HPlotChart.java
/** * Exports the image to some graphic format. *///w w w . ja va 2 s .c om protected void exportImage() { JFrame jm = getFrame(); JFileChooser fileChooser = jhplot.gui.CommonGUI.openImageFileChooser(jm); if (fileChooser.showDialog(jm, "Save As") == 0) { final File scriptFile = fileChooser.getSelectedFile(); if (scriptFile == null) return; else if (scriptFile.exists()) { int res = JOptionPane.showConfirmDialog(jm, "The file exists. Do you want to overwrite the file?", "", JOptionPane.YES_NO_OPTION); if (res == JOptionPane.NO_OPTION) return; } String mess = "write image file .."; JHPlot.showStatusBarText(mess); Thread t = new Thread(mess) { public void run() { export(scriptFile.getAbsolutePath()); }; }; t.start(); } }
From source file:gdt.jgui.entity.webset.JWeblinksPanel.java
/** * Get the context menu.//from w ww.ja v a2 s . c o m * @return the context menu. */ @Override public JMenu getContextMenu() { menu = super.getContextMenu(); int cnt = menu.getItemCount(); mia = new JMenuItem[cnt]; for (int i = 0; i < cnt; i++) mia[i] = menu.getItem(i); menu.addMenuListener(new MenuListener() { @Override public void menuSelected(MenuEvent e) { //System.out.println("WeblinkPanel:getConextMenu:menu selected"); menu.removeAll(); if (mia != null) { for (JMenuItem mi : mia) menu.add(mi); menu.addSeparator(); } if (hasSelectedItems()) { JMenuItem deleteItem = new JMenuItem("Delete"); deleteItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { int response = JOptionPane.showConfirmDialog(console.getContentPanel(), "Delete ?", "Confirm", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (response == JOptionPane.YES_OPTION) { String[] sa = JWeblinksPanel.this.listSelectedItems(); if (sa == null) return; String webLinkKey$; Entigrator entigrator = console.getEntigrator(entihome$); Sack entity = entigrator.getEntityAtKey(entityKey$); for (String aSa : sa) { webLinkKey$ = Locator.getProperty(aSa, WEB_LINK_KEY); if (webLinkKey$ == null) continue; entity.removeElementItem("web", webLinkKey$); entity.removeElementItem("web.login", webLinkKey$); entity.removeElementItem("web.icon", webLinkKey$); } entigrator.save(entity); JConsoleHandler.execute(console, locator$); } } }); menu.add(deleteItem); JMenuItem copyItem = new JMenuItem("Copy"); copyItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JItemPanel[] ipa = JWeblinksPanel.this.getItems(); ArrayList<String> sl = new ArrayList<String>(); for (JItemPanel ip : ipa) if (ip.isChecked()) sl.add(ip.getLocator()); String[] sa = sl.toArray(new String[0]); console.clipboard.clear(); for (String aSa : sa) console.clipboard.putString(aSa); } }); menu.add(copyItem); } JMenuItem newItem = new JMenuItem("New"); newItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { System.out.println("WeblinksPanel:new:" + locator$); Entigrator entigrator = console.getEntigrator(entihome$); Sack entity = entigrator.getEntityAtKey(entityKey$); if (!entity.existsElement("web")) entity.createElement("web"); String webLinkKey$ = Identity.key(); entity.putElementItem("web", new Core("Google", webLinkKey$, "http://www.google.com")); if (!entity.existsElement("web.icon")) entity.createElement("web.icon"); String icon$ = Support.readHandlerIcon(null, JEntitiesPanel.class, "globe.png"); entity.putElementItem("web.icon", new Core(null, webLinkKey$, icon$)); entigrator.save(entity); JWeblinkEditor wle = new JWeblinkEditor(); String wleLocator$ = wle.getLocator(); wleLocator$ = Locator.append(wleLocator$, Entigrator.ENTIHOME, entihome$); wleLocator$ = Locator.append(wleLocator$, EntityHandler.ENTITY_KEY, entityKey$); wleLocator$ = Locator.append(wleLocator$, WEB_LINK_KEY, webLinkKey$); String requesterResponseLocator$ = Locator.compressText(getLocator()); wleLocator$ = Locator.append(wleLocator$, JRequester.REQUESTER_RESPONSE_LOCATOR, requesterResponseLocator$); JConsoleHandler.execute(console, wleLocator$); } }); menu.add(newItem); if (hasItemsToPaste()) { JMenuItem pasteItem = new JMenuItem("Paste"); pasteItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { String[] sa = getItemsToPaste(); Entigrator entigrator = console.getEntigrator(entihome$); Sack entity = entigrator.getEntityAtKey(entityKey$); if (!entity.existsElement("web")) entity.createElement("web"); if (!entity.existsElement("web.icon")) entity.createElement("web.icon"); if (!entity.existsElement("web.login")) entity.createElement("web.login"); Properties itemLocator; String webLinkKey$; String webLinkUrl$; String webLinkName$; String webLinkIcon$; String webLinkLogin$; String webLinkPassword$; for (String aSa : sa) { itemLocator = Locator.toProperties(aSa); webLinkKey$ = itemLocator.getProperty(WEB_LINK_KEY); webLinkUrl$ = itemLocator.getProperty(WEB_LINK_URL); webLinkName$ = itemLocator.getProperty(WEB_LINK_NAME); webLinkIcon$ = itemLocator.getProperty(Locator.LOCATOR_ICON); webLinkLogin$ = itemLocator.getProperty(WEB_LINK_LOGIN); webLinkPassword$ = itemLocator.getProperty(WEB_LINK_PASSWORD); if (webLinkKey$ == null || webLinkUrl$ == null) continue; entity.putElementItem("web", new Core(webLinkName$, webLinkKey$, webLinkUrl$)); if (webLinkLogin$ != null || webLinkPassword$ != null) entity.putElementItem("web.login", new Core(webLinkLogin$, webLinkKey$, webLinkPassword$)); if (webLinkIcon$ != null) entity.putElementItem("web.icon", new Core(null, webLinkKey$, webLinkIcon$)); } entigrator.save(entity); JConsoleHandler.execute(console, getLocator()); } }); menu.add(pasteItem); } menu.addSeparator(); JMenuItem doneItem = new JMenuItem("Done"); doneItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (requesterResponseLocator$ != null) { try { byte[] ba = Base64.decodeBase64(requesterResponseLocator$); String responseLocator$ = new String(ba, "UTF-8"); JConsoleHandler.execute(console, responseLocator$); } catch (Exception ee) { Logger.getLogger(JWeblinksPanel.class.getName()).severe(ee.toString()); } } else console.back(); } }); menu.add(doneItem); } @Override public void menuDeselected(MenuEvent e) { } @Override public void menuCanceled(MenuEvent e) { } }); return menu; }
From source file:condorclient.MainFXMLController.java
@FXML void pauseButtonFired(ActionEvent event) { int delNo = 0; int pauseId = 0; int n = JOptionPane.showConfirmDialog(null, "??", "", JOptionPane.YES_NO_OPTION); if (n == JOptionPane.YES_OPTION) { //checkboxclusterId System.out.print(Thread.currentThread().getName() + "\n"); URL url = null;//from w w w. ja v a 2 s . c om XMLHandler handler = new XMLHandler(); String scheddStr = handler.getURL("schedd"); try { url = new URL(scheddStr); } catch (MalformedURLException e3) { // TODO Auto-generated catch block e3.printStackTrace(); } Schedd schedd = null; try { schedd = new Schedd(url); } catch (ServiceException ex) { Logger.getLogger(CondorClient.class.getName()).log(Level.SEVERE, null, ex); } //ClassAdStructAttr[] int boxToClusterId; ClassAd ad = null;//birdbath.ClassAd; ClassAdStructAttr[][] classAdArray = null; Transaction xact = schedd.createTransaction(); try { xact.begin(30); } catch (RemoteException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } int job = 0; //s final List<?> selectedNodeList = new ArrayList<>(table.getSelectionModel().getSelectedItems()); for (Object o : selectedNodeList) { if (o instanceof ObservableDisplayedClassAd) { pauseId = Integer.parseInt(((ObservableDisplayedClassAd) o).getClusterId()); } } //e String findreq = "owner==\"" + condoruser + "\"&&ClusterId==" + pauseId; try { classAdArray = schedd.getJobAds(findreq); } catch (RemoteException ex) { Logger.getLogger(MainFXMLController.class.getName()).log(Level.SEVERE, null, ex); } String showJobStatus = null; for (ClassAdStructAttr[] x : classAdArray) { ad = new ClassAd(x); job = Integer.parseInt(ad.get("ProcId")); status = Integer.valueOf(ad.get("JobStatus")); showJobStatus = statusName[status]; try { if (showJobStatus.equals("") || showJobStatus.equals("?") || showJobStatus.equals("")) { xact.holdJob(pauseId, job, ""); } else {//?? if (showJobStatus.equals("?") || showJobStatus.equals("")) { JOptionPane.showMessageDialog(null, "?????"); return; } } // System.out.print("ts.getClusterId():" + showClusterId + "\n"); } catch (RemoteException ex) { Logger.getLogger(MainFXMLController.class.getName()).log(Level.SEVERE, null, ex); } } try { xact.commit(); } catch (RemoteException e) { e.printStackTrace(); } } else if (n == JOptionPane.NO_OPTION) { System.out.println("qu xiao"); } }
From source file:com.adito.upgrade.GUIUpgrader.java
public void upgrade() throws Exception { if (JOptionPane.showConfirmDialog(this, "All selected resources will be now upgrade from the source installation to the target. Are you sure you wish to continue?", "Run Upgrade", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE) == JOptionPane.YES_OPTION) { ///* w w w.j av a 2 s . c o m*/ final List l = new ArrayList(); for (int i = 0; i < upgradeSelectionPanel.getComponentCount(); i++) { JCheckBox b = (JCheckBox) upgradeSelectionPanel.getComponent(i); if (b.isSelected()) { l.add(b.getClientProperty("upgrade")); } } removeUpgradeSelectionComponent(); invalidate(); removeAll(); // Progress panel JPanel progressPanel = new JPanel(new BorderLayout()); progressPanel.setBorder(BorderFactory.createTitledBorder("Progress")); final JProgressBar b = new JProgressBar(0, l.size()); b.setStringPainted(true); progressPanel.add(b, BorderLayout.CENTER); add(progressPanel, BorderLayout.NORTH); // Console panel JPanel consolePanel = new JPanel(new BorderLayout()); consolePanel.setBorder(BorderFactory.createTitledBorder("Output")); console = new JTextPane(); JScrollPane scrollPane = new JScrollPane(console); consolePanel.add(scrollPane, BorderLayout.CENTER); add(consolePanel, BorderLayout.CENTER); // validate(); repaint(); // Thread t = new Thread() { public void run() { try { for (Iterator i = l.iterator(); i.hasNext();) { AbstractDatabaseUpgrade upgrade = (AbstractDatabaseUpgrade) i.next(); b.setValue(b.getValue() + 1); upgrade.upgrade(GUIUpgrader.this); try { Thread.sleep(750); } catch (InterruptedException ie) { } } info("Complete"); Toolkit.getDefaultToolkit().beep(); } catch (Exception e) { error("Failed to upgrade.", e); } } }; t.start(); } }