List of usage examples for javax.swing JOptionPane QUESTION_MESSAGE
int QUESTION_MESSAGE
To view the source code for javax.swing JOptionPane QUESTION_MESSAGE.
Click Source Link
From source file:de.adv_online.aaa.profiltool.ProfilDialog.java
protected void closeDialog() { try {/* w w w . jav a2 s . c o m*/ String msg = null; if (transformationRunning) msg = "Eine Profilerzeugung luft derzeit.\n";// Meldung if (msg != null) { msg += "Soll die Anwendung beendet werden?"; Object[] options = { "Exit", "Cancel" }; int val = JOptionPane.showOptionDialog(null, msg, "Confirmation", JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[1]); if (val == 1) return; } if (model != null) model.shutdown(); System.exit(0); } catch (Exception e) { System.out.println("closeDialog - Exception: " + e.toString()); //System.exit(1); } }
From source file:edu.ku.brc.af.ui.forms.IconViewObj.java
/** * /*from w w w . j ava2 s . c o m*/ */ protected void doDelete() { FormDataObjIFace dataObj = iconTray.getSelection(); if (dataObj != null) { Object[] delBtnLabels = { getResourceString("Delete"), getResourceString("CANCEL") }; int rv = JOptionPane.showOptionDialog(UIRegistry.getTopWindow(), UIRegistry.getLocalizedMessage("ASK_DELETE", dataObj.getIdentityTitle()), getResourceString("Delete"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, delBtnLabels, delBtnLabels[1]); if (rv == JOptionPane.YES_OPTION) { iconTray.removeItem(dataObj); parentDataObj.removeReference(dataObj, IconViewObj.this.cellName); if (mvParent != null) { MultiView topLvl = mvParent.getTopLevel(); topLvl.addDeletedItem(dataObj); rootHasChanged(); } iconTray.repaint(); updateEnableUI(); rootHasChanged(); } } }
From source file:com.sciaps.view.SpectrumShotPanel.java
private void doDeleteScan() { boolean allgood = false; if (tblShots_.getRowCount() == 0) { showErrorDialog("List is Empty. Nothing to delete."); return;/*from ww w.j a v a 2s . co m*/ } while (allgood == false) { String retval = JOptionPane.showInputDialog(Constants.MAIN_FRAME, "Enter the scan number to delete:", "Delete Scan", JOptionPane.QUESTION_MESSAGE); if (retval == null) { allgood = true; } else { try { int scanID = Integer.parseInt(retval); if (scanID > 0) { allgood = true; shotListTableModel_.deleteScan(scanID); } } catch (NumberFormatException ex) { showErrorDialog("Invalid Scan #: " + retval); } } } }
From source file:com.diversityarrays.kdxplore.trialmgr.TrialManagerApp.java
@Override public AfterUpdateResult initialiseAppAfterUpdateCheck(AppInitContext initContext) { final AfterUpdateResult[] initResult = new AfterUpdateResult[1]; initResult[0] = AfterUpdateResult.OK; trialExplorerPanel.doPostOpenOperations(); String currentDatabaseUrl = explorerProperties.getCurrentDatabaseUrl(); if (!KdxploreDatabase.LOCAL_DATABASE_URL.equalsIgnoreCase(currentDatabaseUrl)) { clientProvider.setInitialClientUrl(currentDatabaseUrl); }/*from ww w . j a v a 2 s . c o m*/ clientProvider.setInitialClientUsername(explorerProperties.getCurrentDatabaseUsername()); if (currentDatabaseUrl == null) { currentDatabaseUrl = KdxploreDatabase.LOCAL_DATABASE_URL; } Closure<DatabaseDataLoadResult> loadDataErrorCompleteHandler = new Closure<DatabaseDataLoadResult>() { @Override public void execute(DatabaseDataLoadResult result) { Throwable problem = result.cause; if (problem == null) { // If user is logged in it may be to another database // so ensure we don't get confused by shutting down the extant connection. if (clientProvider.isClientAvailable()) { DALClient client = clientProvider.getDALClient(); if (!client.getBaseUrl().equalsIgnoreCase(result.dbUrl)) { clientProvider.logout(); } } String initialTabName = TAB_TRIALS; if (KdxploreConfig.getInstance().getModeList().contains("CIMMYT") && trialExplorerPanel.getTrialCount() <= 0 && traitExplorerPanel.getTraitCount() <= 0) { // This will suggest that the user loads traits first. initialTabName = TAB_TRAITS; // The reason for this in CIMMYT mode is that because the // user isn't able to get the Traits from the database // they really should load the Traits first. // } int index = tabbedPane.indexOfTab(initialTabName); tabbedPane.setSelectedIndex(index); } else { problem.printStackTrace(); messagesPanel.println(problem); Throwable lastCause = null; Throwable cause = problem; while (cause != null) { lastCause = cause; cause = cause.getCause(); } if (lastCause != null) { Shared.Log.e(TAG, "Initialisation Failed", lastCause); //$NON-NLS-1$ } // Replace all extant tabs with the Error tab. for (int tabIndex = tabbedPane.getTabCount(); --tabIndex >= 0;) { tabbedPane.remove(tabIndex); } StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); result.cause.printStackTrace(pw); pw.close(); JTextArea ta = new JTextArea(sw.toString()); ta.setEditable(false); tabbedPane.addTab(Msg.TAB_INIT_ERROR(), new JScrollPane(ta)); initResult[0] = AfterUpdateResult.FAIL_IF_ALL; String errmsg = lastCause == null ? "" : lastCause.getMessage(); //$NON-NLS-1$ GuiUtil.errorMessage(TrialManagerApp.this, Msg.ERRMSG_CHECK_MESSSAGES_URL_CAUSE(result.dbUrl, errmsg), OfflineData.LOADING_OFFLINE_REFERENCE_DATA_ERROR()); } } }; List<DatabaseDataStub> databaseStubs = DatabaseDataUtils.collectDatabaseDirectories(userDataFolder, driverType); DatabaseDataStub chosen = null; if (databaseStubs.isEmpty()) { // This is a brand new one. chosen = DatabaseDataStub.create(driverType, userDataFolder, currentDatabaseUrl); // Path dirPath = Paths.get(defaultKdxploreDatabaseLocation.databaseDirectory.getPath()); // boolean isDefaultDatabase = defaultKdxploreDatabaseLocation.databaseDirectory.equals(dirPath.toFile()); // chosen = new DatabaseDataStub(isDefaultDatabase, defaultKdxploreDatabaseLocation.driverType, dirPath, currentDatabaseUrl, null); } else { if (databaseStubs.size() == 1) { chosen = databaseStubs.get(0); } else { DatabaseDataStub[] selectionValues = databaseStubs .toArray(new DatabaseDataStub[databaseStubs.size()]); for (DatabaseDataStub dds : selectionValues) { if (currentDatabaseUrl.equalsIgnoreCase(dds.dburl)) { chosen = dds; break; } } if (chosen == null) { chosen = selectionValues[0]; } Object answer = JOptionPane.showInputDialog(TrialManagerApp.this, Msg.MSG_CHOOSE_DATABASE_TO_OPEN_DEFAULT(chosen.toString()), Msg.TITLE_MULTIPLE_DATABASES_FOUND(), JOptionPane.QUESTION_MESSAGE, null, selectionValues, chosen); if (answer instanceof DatabaseDataStub) { chosen = (DatabaseDataStub) answer; } } } if (chosen == null) { initResult[0] = AfterUpdateResult.FAIL_IF_ALL; // System.exit(0); } else { loadOfflineDataAsync(chosen, loadDataErrorCompleteHandler); trialExplorerPanel.initialiseUploadHandler(offlineData); } return initResult[0]; }
From source file:com.holycityaudio.SpinCAD.SpinCADFile.java
public void fileSaveSpj(SpinCADBank bank) { // Create a file chooser String savedPath = prefs.get("MRUSpjFolder", ""); String[] spnFileNames = new String[8]; final JFileChooser fc = new JFileChooser(savedPath); // In response to a button click: FileNameExtensionFilter filter = new FileNameExtensionFilter("Spin Project Files", "spj"); fc.setFileFilter(filter);/*www . j av a 2 s .c o m*/ // XXX debug fc.showSaveDialog(new JFrame()); File fileToBeSaved = fc.getSelectedFile(); if (!fc.getSelectedFile().getAbsolutePath().endsWith(".spj")) { fileToBeSaved = new File(fc.getSelectedFile() + ".spj"); } int n = JOptionPane.YES_OPTION; if (fileToBeSaved.exists()) { JFrame frame1 = new JFrame(); n = JOptionPane.showConfirmDialog(frame1, "Would you like to overwrite it?", "File already exists!", JOptionPane.YES_NO_OPTION); } if (n == JOptionPane.YES_OPTION) { // filePath points at the desired Spj file String filePath = fileToBeSaved.getPath(); String folder = fileToBeSaved.getParent().toString(); // export the individual SPN files for (int i = 0; i < 8; i++) { try { String asmFileNameRoot = FilenameUtils.removeExtension(bank.patch[i].patchFileName); String asmFileName = folder + "\\" + asmFileNameRoot + ".spn"; if (bank.patch[i].patchFileName != "Untitled") { fileSaveAsm(bank.patch[i], asmFileName); spnFileNames[i] = asmFileName; } } catch (IOException e) { JOptionPane.showOptionDialog(null, "File save error!", "Error", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, null); e.printStackTrace(); } finally { } } // now create the Spin Project file fileToBeSaved.delete(); BufferedWriter writer = null; try { writer = new BufferedWriter(new FileWriter(fileToBeSaved, true)); } catch (IOException e1) { e1.printStackTrace(); } try { writer.write("NUMDOCS:8"); writer.newLine(); } catch (IOException e1) { e1.printStackTrace(); } for (int i = 0; i < 8; i++) { try { if (bank.patch[i].patchFileName != "Untitled") { writer.write(spnFileNames[i] + ",1"); } else { writer.write(",0"); } writer.newLine(); } catch (IOException e) { JOptionPane.showOptionDialog(null, "File save error!\n" + filePath, "Error", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, null); e.printStackTrace(); } } // write the build flags try { writer.write(",1,1,1"); writer.newLine(); } catch (IOException e1) { e1.printStackTrace(); } try { writer.close(); } catch (IOException e) { e.printStackTrace(); } saveMRUSpjFolder(filePath); } }
From source file:com.pianobakery.complsa.LicenseKeyGUI.java
private void changeProductKeyjButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_changeProductKeyjButtonActionPerformed /**// ww w .j a v a 2s. c o m * Basically we show an input dialog to get license key. It will be * better to use a JDialog with required license key input fields. */ String key = JOptionPane.showInputDialog(null, "Enter License Key", "License Key", JOptionPane.QUESTION_MESSAGE); if (key != null) { key = key.trim(); // the license key (trim it because user may copy/paste with spaces etc) /** * First validate license and get a temporary license object to * check for validation status later. */ License temporaryLicenseObject = LicenseValidator.validate(key, publicKey, internalString, nameforValidation, companyforValidation, hardwareIDMethod); /** * If given license key is valid, then save it on disk, and update * GUI fields. */ if (temporaryLicenseObject.getValidationStatus() == ValidationStatus.LICENSE_VALID) { licenseObject = temporaryLicenseObject; try { /** * We use Apache commons-io (FileUtils class) to easily save * string to file. */ FileUtils.writeStringToFile(new File(licenseKeyFileOnDisk), key); /** * Since license key is changed delete license text file if * exists on disk left from previous license key. */ FileUtils.deleteQuietly(new File(licenseTextFileOnDisk)); } catch (IOException ex) { Logger.getLogger(LicenseKeyGUI.class.getName()).log(Level.SEVERE, null, ex); } updateGUIFieldsWithLicenseObject(); } else { /** * If given license is not valid, display an error message. */ JOptionPane.showMessageDialog(null, "License error: " + temporaryLicenseObject.getValidationStatus(), "License Error", JOptionPane.ERROR_MESSAGE); } } }
From source file:com.sshtools.sshterm.SshTermSessionPanel.java
/** * * * @return/*from w ww .j a v a 2 s . c o m*/ */ public boolean canClose() { if ((session != null) && session.isOpen()) { setFullScreenMode(false); if (JOptionPane.showConfirmDialog(this, "Close the current session?", "Close Session", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.NO_OPTION) { return false; } } return true; }
From source file:UserInterface.FinanceRole.TransferToRegSiteJPanel.java
private void donateJButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_donateJButtonActionPerformed //Validation/*from w ww .jav a 2 s . c o m*/ boolean validationSuccess; validationSuccess = validationIndividualTansfer(); if (validationSuccess) { RegisteredSiteEnterprise objRegisteredSiteEnterprise = null; int selectedRegSite = regSiteJTable.getSelectedRow(); if (selectedRegSite < 0) { JOptionPane.showMessageDialog(null, "Please select a Site"); return; } objRegisteredSiteEnterprise = (RegisteredSiteEnterprise) regSiteJTable.getValueAt(selectedRegSite, 1); if (objRegisteredSiteEnterprise != null) { objWorldEnterprise.getObjTransactionDirectory().updateTransactionAccount(); BigDecimal worldBalance = objWorldEnterprise.getObjTransactionDirectory().getAvailableRealBalance(); int positiveWorldBalance = worldBalance.compareTo(individualDonationAmount); if (positiveWorldBalance >= 1) { int response = JOptionPane.showConfirmDialog(null, "Total transfer of $ " + individualDonationAmount + "/- Do you want to transfer?", "Confirm", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (response == JOptionPane.YES_OPTION) { //Registered Site Transaction Transaction objRealRSTransaction = (Transaction) objRegisteredSiteEnterprise .getObjTransactionDirectory().addNewTransaction(); objRealRSTransaction.setTransactionBDAmount(individualDonationAmount); objRealRSTransaction.setObjUserAccountSource(objUserAccount); objRealRSTransaction.setObjUserAccountDestination(null); objRealRSTransaction.setTransactionSource( Transaction.TransactionSourceType.FromWorldEnterprise.getValue()); objRealRSTransaction.setTransactionDestination( Transaction.TransactionSourceType.ToRegSiteEnterprise.getValue()); objRealRSTransaction.setTransactionType(Transaction.TransactionType.Credit.getValue()); objRealRSTransaction.setTransactionMode(Transaction.TransactionModeType.Real.getValue()); objRegisteredSiteEnterprise.getObjTransactionDirectory().updateTransactionAccount(); //WorldEnterprise Transaction Transaction objRealWETransaction = (Transaction) objWorldEnterprise .getObjTransactionDirectory().addNewTransaction(); objRealWETransaction.setTransactionBDAmount(individualDonationAmount); objRealWETransaction.setObjUserAccountSource(objUserAccount); objRealWETransaction.setObjUserAccountDestination(null); objRealWETransaction.setTransactionSource( Transaction.TransactionSourceType.FromWorldEnterprise.getValue()); objRealWETransaction.setTransactionDestination( Transaction.TransactionSourceType.ToRegSiteEnterprise.getValue()); objRealWETransaction.setTransactionType(Transaction.TransactionType.Debit.getValue()); objRealWETransaction.setTransactionMode(Transaction.TransactionModeType.Real.getValue()); objWorldEnterprise.getObjTransactionDirectory().updateTransactionAccount(); populateTransactionTable(objRegisteredSiteEnterprise); JOptionPane.showMessageDialog(null, "$ " + individualDonationAmount + "/- transferred successfully"); donationAmountJTextField.setText(null); populateLowRegSiteTable(); //RegSiteTransferRecords String donationLogs = objRealWETransaction.getTransactionID() + "," + objRealWETransaction.getTransactionBDAmount() + "," + objRealWETransaction.getObjUserAccountSource() + "," + objRealWETransaction.getTransactionSource() + "," + objRegisteredSiteEnterprise + "," + objRealWETransaction.getTransactionDestination() + "," + objRealWETransaction.getTransactionType() + "," + objRealWETransaction.getTransactionMode(); GenerateReports.regSiteTransferRecords(donationLogs); } } else { JOptionPane.showMessageDialog(null, "World Balance is low"); } } else { JOptionPane.showMessageDialog(null, "Please select again"); } } }
From source file:de.adv_online.aaa.katalogtool.KatalogDialog.java
protected void closeDialog() { try {//from w ww . j a v a2 s .co m String msg = null; if (transformationRunning) msg = "Eine Katalogerzeugung luft derzeit.\n";// Meldung if (msg != null) { msg += "Soll die Anwendung beendet werden?"; Object[] options = { "Exit", "Cancel" }; int val = JOptionPane.showOptionDialog(null, msg, "Confirmation", JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[1]); if (val == 1) return; } if (model != null) model.shutdown(); System.exit(0); } catch (Exception e) { System.out.println("closeDialog - Exception: " + e.toString()); //System.exit(1); } }
From source file:AltiConsole.AltiConsoleMainScreen.java
/** * Starting point for the altimeter console application. * //from www . j a v a 2s. c o m * @param args * ignored. */ public static void main(final String[] args) { initializeL10n(); final Translator trans = Application.getTranslator(); Splash.init(); // "Altimeter console" final AltiConsoleMainScreen alticonsole = new AltiConsoleMainScreen( trans.get("AltiConsoleMainScreen.Title")); Image icone; URL myURL; myURL = AltiConsoleMainScreen.class.getResource("/pix/bear_altimeters-small.png"); if (myURL == null) myURL = AltiConsoleMainScreen.class.getResource("/bear_altimeters-small.png"); icone = Toolkit.getDefaultToolkit().getImage(myURL); if (icone == null) { icone = Toolkit.getDefaultToolkit() .getImage(AltiConsoleMainScreen.class.getResource("/bear_altimeters-small.png")); } alticonsole.pack(); alticonsole.setIconImage(icone); alticonsole.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); alticonsole.addWindowListener(new java.awt.event.WindowAdapter() { @Override public void windowClosing(java.awt.event.WindowEvent windowEvent) { System.out.println("exit and disconnecting\n"); if (JOptionPane.showConfirmDialog(alticonsole, trans.get("AltiConsoleMainScreen.ClosingWindow"), trans.get("AltiConsoleMainScreen.ReallyClosing"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.YES_OPTION) { alticonsole.DisconnectFromAlti(); System.exit(0); } } }); RefineryUtilities.centerFrameOnScreen(alticonsole); alticonsole.setVisible(true); }