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:cl.almejo.vsim.gui.SimWindow.java
private int askSureToQuit() { return JOptionPane.showConfirmDialog(this, Messages.t("action.quit.message"), Messages.t("action.quit.title"), JOptionPane.YES_NO_OPTION); }
From source file:com.sshtools.common.ui.SshToolsApplicationClientPanel.java
/** * * * @param disconnect/*from w w w .j a v a 2 s . c o m*/ */ public void closeConnection(boolean disconnect) { // if (isNeedSave() && (currentConnectionFile != null)) { // Stop save dialog box when not using a pre-existing profile. // Only allow saving of files if allowed by the security manager try { if (System.getSecurityManager() != null) { AccessController.checkPermission(new FilePermission("<<ALL FILES>>", "write")); if (JOptionPane.showConfirmDialog(this, "You have unsaved changes to the connection " + ((currentConnectionFile == null) ? "<Untitled>" : currentConnectionFile.getName()) + ".\nDo you want to save the changes now?", "Unsaved changes", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.YES_OPTION) { saveConnection(false, getCurrentConnectionFile(), getCurrentConnectionProfile()); setNeedSave(false); } } } catch (AccessControlException ace) { log.warn("Changes made to connection, but security manager won't allow saving of files."); } } //setCurrentConnectionFile(null); }
From source file:com.gnadenheimer.mg.frames.admin.FrameConfigAdmin.java
private void cmdResetActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmdResetActionPerformed try {//from w w w . j av a 2 s . c om Integer reply = JOptionPane.showConfirmDialog(null, "Realmente desea borrar todos los datos y limpiar la base de datos?", title, JOptionPane.YES_NO_OPTION); if (reply == JOptionPane.YES_OPTION) { Utils.getInstance().executeSQL(cboSqlFiles.getSelectedItem().toString()); } } catch (Exception ex) { JOptionPane.showMessageDialog(null, Thread.currentThread().getStackTrace()[1].getMethodName() + " - " + ex.getMessage()); LOGGER.error(Thread.currentThread().getStackTrace()[1].getMethodName(), ex); } }
From source file:ded.ui.DiagramController.java
/** Prompt for a file name to load, then replace the current diagram with it. */ public void loadFromFile() { if (this.isDirty()) { int res = JOptionPane.showConfirmDialog(this, "There are unsaved changes. Load new diagram anyway?", "Load Confirmation", JOptionPane.YES_NO_OPTION); if (res != JOptionPane.YES_OPTION) { return; }// w w w. j a va 2 s. c o m } JFileChooser chooser = new JFileChooser(); chooser.setCurrentDirectory(this.currentFileChooserDirectory); chooser.addChoosableFileFilter( new FileNameExtensionFilter("Diagram and ER Editor Files (.ded, .png, .er)", "ded", "png", "er")); int res = chooser.showOpenDialog(this); if (res == JFileChooser.APPROVE_OPTION) { this.currentFileChooserDirectory = chooser.getCurrentDirectory(); this.loadFromNamedFile(chooser.getSelectedFile().getAbsolutePath()); } }
From source file:condorclient.MainFXMLController.java
@FXML public void releaseJobFired(ActionEvent event) { int releaseNo = 0; int releaseClusterId = 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 . j av a2s . c om XMLHandler handler = new XMLHandler(); String scheddStr = handler.getURL("schedd"); try { url = new URL(scheddStr); //url = new URL("http://localhost:9628"); } 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[] ClassAd ad = null;//birdbath.ClassAd; ClassAdStructAttr[][] classAdArray = null; int tmp1 = 0; final List<?> selectedNodeList = new ArrayList<>(table.getSelectionModel().getSelectedItems()); for (Object o : selectedNodeList) { if (o instanceof ObservableDisplayedClassAd) { releaseClusterId = Integer.parseInt(((ObservableDisplayedClassAd) o).getClusterId()); } } //e int job = 0; Transaction xact = schedd.createTransaction(); try { xact.begin(30); } catch (RemoteException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } System.out.println("releaseClusterId:" + releaseClusterId); // String findreq = "owner==\"htcondor\"&&ClusterId==" + releaseClusterId; String findreq = "owner==\"" + condoruser + "\"&&ClusterId==" + releaseClusterId; 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("")) { xact.releaseJob(releaseClusterId, job, ""); } else {//???? if (showJobStatus.equals("?") || showJobStatus.equals("?") || showJobStatus.equals("") || showJobStatus.equals("") || showJobStatus.equals("")) { JOptionPane.showMessageDialog(null, "?????"); return; } } System.out.print("ts.releaseClusterId():" + releaseClusterId + "job" + job + "\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.net2plan.gui.utils.topologyPane.TopologyPanel.java
/** * Loads traffic demands from a {@code .n2p} file, overriding current demands. * * @since 0.3.0//w w w . jav a 2 s . c o m */ public void loadTrafficDemands() { try { checkDemandFileChooser(); int rc = fc_demands.showOpenDialog(null); if (rc != JFileChooser.APPROVE_OPTION) return; NetPlan demands = fc_demands.readDemands(); if (!demands.hasDemands() && !demands.hasMulticastDemands()) throw new Net2PlanException("Selected file doesn't contain a demand set"); NetPlan netPlan = callback.getDesign(); if (netPlan.hasDemands() || netPlan.hasMulticastDemands()) { int result = JOptionPane.showConfirmDialog(null, "Current network structure contains a demand set. Overwrite?", "Loading demand set", JOptionPane.YES_NO_OPTION); if (result != JOptionPane.YES_OPTION) return; } NetPlan aux_netPlan = netPlan.copy(); try { netPlan.removeAllDemands(); for (Demand demand : demands.getDemands()) netPlan.addDemand(netPlan.getNode(demand.getIngressNode().getIndex()), netPlan.getNode(demand.getEgressNode().getIndex()), demand.getOfferedTraffic(), demand.getAttributes()); netPlan.removeAllMulticastDemands(); for (MulticastDemand demand : demands.getMulticastDemands()) { Set<Node> egressNodesThisNetPlan = new HashSet<Node>(); for (Node n : demand.getEgressNodes()) egressNodesThisNetPlan.add(netPlan.getNode(n.getIndex())); netPlan.addMulticastDemand(netPlan.getNode(demand.getIngressNode().getIndex()), egressNodesThisNetPlan, demand.getOfferedTraffic(), demand.getAttributes()); } callback.getVisualizationState().resetPickedState(); callback.updateVisualizationAfterChanges( Sets.newHashSet(NetworkElementType.DEMAND, NetworkElementType.MULTICAST_DEMAND)); callback.getUndoRedoNavigationManager().addNetPlanChange(); } catch (Throwable ex) { callback.getDesign().assignFrom(aux_netPlan); throw new RuntimeException(ex); } } catch (Net2PlanException ex) { if (ErrorHandling.isDebugEnabled()) ErrorHandling.addErrorOrException(ex, TopologyPanel.class); ErrorHandling.showErrorDialog(ex.getMessage(), "Error loading traffic demands"); } catch (Exception ex) { ErrorHandling.addErrorOrException(ex, TopologyPanel.class); ErrorHandling.showErrorDialog("Error loading traffic demands"); } }
From source file:Forms.frm_Penghuni.java
private void btnSimpanActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSimpanActionPerformed // TODO add your handling code here: String nama = tfNamaPenghuni.getText(); String alamat = tfAlamatPenghuni.getText(); String t4_lahir = tfTempatLahirPenghuni.getText(); DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); String tgl_lahir = dateFormat.format(dcTanggalLahirPenghuni.getDate()); String gender = cbGender.getSelectedItem().toString(); String email = tfEmail.getText(); String no_ktp = tfNomorKTP.getText(); String no_telp = tfNomorTelp.getText(); String pekerjaan = tfPekerjaan.getText(); String alamat_pekerjaan = tfAlamatPekerjaan.getText(); String nt_pekerjaan = tfNomorTelpPekerjaan.getText(); String pasfoto = tfPasFoto.getText(); String foto_ktp = tfPasKTP.getText(); if (validasiID(id_penyewa)) { int pilihan = JOptionPane.showConfirmDialog(this, "Apakah Anda Ingin Mengubah data? ", "Konfirmasi", JOptionPane.YES_NO_OPTION); if (pilihan == 0) { if (validasitanggal()) { int baris = tblPenghuni.getSelectedRow(); String id = tblPenghuni.getValueAt(baris, 0).toString(); if (UbahDataPenghuni(id, nama, alamat, t4_lahir, tgl_lahir, gender, email, no_ktp, no_telp, pekerjaan, alamat_pekerjaan, nt_pekerjaan, pasfoto, foto_ktp)) { JOptionPane.showMessageDialog(null, "Berhasil Ubah Data"); InitTable();//from w w w. jav a 2s . c o m TampilDataPenghuni(); bersihkanfield(); KunciField(false); btnSimpan.setEnabled(false); } else { JOptionPane.showConfirmDialog(null, "Gagal Ubah Data"); } } } } else { int pilihan = JOptionPane.showConfirmDialog(this, "Apakah Anda Ingin Menambah data? ", "Konfirmasi", JOptionPane.YES_NO_OPTION); if (pilihan == 0) { if (validasiNama(nama)) { JOptionPane.showMessageDialog(null, "Nama Penghuni Sudah Terdaftar...\nNama Tidak Boleh Sama!!"); } else { if (validasitanggal()) { if (salinFoto()) { TambahDataPenghuni(nama, alamat, t4_lahir, tgl_lahir, gender, email, no_ktp, no_telp, pekerjaan, alamat_pekerjaan, nt_pekerjaan, pasfoto, foto_ktp); } else { JOptionPane.showMessageDialog(this, "Foto Tidak Ditemukan.. \nSilahkan Isi Data Dengan Benar!!!"); } bersihkanfield(); KunciField(false); } } } } }
From source file:jeplus.JEPlusFrameMain.java
/** * Start batch operation with a random sample of jobs * @param njobs The number of jobs to run * @param opt//from w w w .j a v a 2s . c o m * @param randomsrc Random generator source. Null means no randomisation is required */ public void startBatchRunSample(int njobs, EPlusBatch.SampleType opt, Random randomsrc) { // Update display if (OutputPanel == null) { OutputPanel = new EPlusTextPanelOld("Output", EPlusTextPanel.VIEWER_MODE); int tabn = TpnEditors.getTabCount(); this.TpnEditors.insertTab("Executing batch ...", null, OutputPanel, "This is the execution log.", tabn); TpnEditors.setSelectedIndex(tabn); } else { TpnEditors.setSelectedComponent(OutputPanel); } if (opt == EPlusBatch.SampleType.SHUFFLE) { // Check batch size if (BatchManager.getBatchInfo().getTotalNumberOfJobs() > 1000000) { // Project is too large StringBuilder buf = new StringBuilder("<html><p>The estimated solution space size ("); buf.append(LargeIntFormatter.format(BatchManager.getBatchInfo().getTotalNumberOfJobs())); buf.append(") is too big. </p><p>Creating a random sample may take a (very) long time. </p>"); buf.append( "<p>The Latin Hypercube Sampling method is more suitable.</p><p>Are you sure you want to continue? </p>"); int res = JOptionPane.showConfirmDialog(this, buf.toString(), "Solution space is too large", JOptionPane.YES_NO_OPTION); if (res == JOptionPane.NO_OPTION) { OutputPanel.appendContent("Sample cancelled.\n"); return; } } OutputPanel.appendContent("Start sampling. Please waite ... \n"); } ActingManager = BatchManager; ActingManager.runSample(opt, njobs, randomsrc); OutputPanel.appendContent("A " + opt + " sample of " + njobs + " jobs has started ...\n"); }
From source file:UserInterface.FinanceRole.TransferToRegSiteJPanel.java
private void autoTransferJButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_autoTransferJButtonActionPerformed //Validation/* www .java 2 s. c o m*/ boolean validationSuccess; validationSuccess = validationAutoTansfer(); if (validationSuccess) { objWorldEnterprise.getObjTransactionDirectory().updateTransactionAccount(); BigDecimal worldDonation = AutoTransfer.transferCheck(objWorldEnterprise, objUserAccount, autoDonationAmount); BigDecimal worldBalance = objWorldEnterprise.getObjTransactionDirectory().getAvailableRealBalance(); System.out.println(worldDonation); System.out.println(objWorldEnterprise.getObjTransactionDirectory().getAvailableRealBalance()); System.out.println(objWorldEnterprise.getObjTransactionDirectory().getAvailableVirtualBalance()); int positiveWorldBalance = worldBalance.compareTo(worldDonation); if (positiveWorldBalance >= 1) { JDialog.setDefaultLookAndFeelDecorated(true); int response = JOptionPane.showConfirmDialog(null, "Total transfer of $ " + worldDonation + "/- Do you want to transfer?", "Confirm", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (response == JOptionPane.YES_OPTION) { System.out.println("Yes button clicked"); worldDonation = AutoTransfer.transferConfirm(objWorldEnterprise, objUserAccount, autoDonationAmount); JOptionPane.showMessageDialog(null, "$ " + worldDonation + "/- transferred successfully"); autoTransferJTextField.setText(null); populateLowRegSiteTable(); } } else { JOptionPane.showMessageDialog(null, "World Balance is low"); } } }
From source file:com.mirth.connect.connectors.tcp.TcpListener.java
private void transmissionModeComboBoxActionPerformed() { String name = (String) transmissionModeComboBox.getSelectedItem(); if (!modeLock && transmissionModeProvider != null) { if (!transmissionModeProvider.getDefaultProperties().equals(transmissionModeProvider.getProperties())) { if (JOptionPane.showConfirmDialog(parent, "Are you sure you would like to change the transmission mode and lose all of the current transmission properties?", "Select an Option", JOptionPane.YES_NO_OPTION) != JOptionPane.YES_OPTION) { modeLock = true;/* w w w. j a va 2 s . c om*/ transmissionModeComboBox.setSelectedItem(selectedMode); modeLock = false; return; } } } selectedMode = name; if (name.equals("Basic TCP")) { transmissionModeProvider = new BasicModeClientProvider(); } else { for (TransmissionModePlugin plugin : LoadedExtensions.getInstance().getTransmissionModePlugins() .values()) { if (plugin.getPluginPointName().equals(name)) { transmissionModeProvider = plugin.createProvider(); } } } if (transmissionModeProvider != null) { transmissionModeProvider.initialize(this); settingsPlaceHolder.removeAll(); settingsPlaceHolder.add(transmissionModeProvider.getSettingsComponent()); } }