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:com.lfv.lanzius.server.LanziusServer.java
public boolean menuChoiceTerminalUnlink(List<Integer> terminalIds) { if (isSwapping) return false; log.info("Menu: Unlink terminals"); int nbrTerminals = terminalIds.size(); if (nbrTerminals > 1) { int r = JOptionPane.showConfirmDialog(frame, "Are you sure you want to unlink " + nbrTerminals + " terminals?", "Unlink?", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (r != JOptionPane.YES_OPTION) return false; }//from w w w . j a v a 2 s. co m boolean update = false; Iterator<Integer> iteri = terminalIds.iterator(); while (iteri.hasNext()) { boolean b = unlinkTerminal(iteri.next().intValue()); update = update || b; } if (update) { updateTerminals(ALL, ALL); updateView(); } return update; }
From source file:com.lfv.lanzius.server.LanziusServer.java
private void menuChoiceTerminalUnlinkAll() { if (isSwapping) return;/*from w ww. j a v a2 s . c o m*/ log.info("Menu: Unlink all terminals"); int r = JOptionPane.showConfirmDialog(frame, "Are you sure you want to unlink all terminals?", "Unlink all?", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (r == JOptionPane.YES_OPTION) { unlinkTerminal(ALL); updateTerminals(ALL, ALL); updateView(); } }
From source file:com.pironet.tda.TDA.java
/** * close the currently selected dump.//w w w . j a v a 2 s.c o m */ private void closeCurrentDump() { TreePath selPath = tree.getSelectionPath(); while (selPath != null && !(checkNameFromNode((DefaultMutableTreeNode) selPath.getLastPathComponent(), File.separator) || checkNameFromNode((DefaultMutableTreeNode) selPath.getLastPathComponent(), 2, File.separator))) { selPath = selPath.getParentPath(); } Object[] options = { "Close File", "Cancel close" }; String fileName = ((DefaultMutableTreeNode) selPath.getLastPathComponent()).getUserObject().toString(); fileName = fileName.substring(fileName.indexOf(File.separator)); int selectValue = JOptionPane.showOptionDialog(null, "<html><body>Are you sure, you want to close the currently selected dump file<br><b>" + fileName + "</b></body></html>", "Confirm closing...", JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[0]); // if first option "close file" is selected. if (selectValue == 0) { // remove stuff from the top nodes topNodes.remove(selPath.getLastPathComponent()); if (topNodes.size() == 0) { // simply do a reinit, as there isn't anything to display removeAll(); revalidate(); init(runningAsJConsolePlugin, runningAsVisualVMPlugin); getMainMenu().getLongMenuItem().setEnabled(false); getMainMenu().getCloseMenuItem().setEnabled(false); getMainMenu().getSaveSessionMenuItem().setEnabled(false); getMainMenu().getCloseToolBarButton().setEnabled(false); getMainMenu().getExpandButton().setEnabled(false); getMainMenu().getCollapseButton().setEnabled(false); getMainMenu().getFindLRThreadsToolBarButton().setEnabled(false); getMainMenu().getCloseAllMenuItem().setEnabled(false); getMainMenu().getExpandAllMenuItem().setEnabled(false); getMainMenu().getCollapseAllMenuItem().setEnabled(false); } else { // rebuild jtree getMainMenu().getCloseMenuItem().setEnabled(false); getMainMenu().getCloseToolBarButton().setEnabled(false); createTree(); } revalidate(); } }
From source file:com.lfv.lanzius.server.LanziusServer.java
public boolean menuChoiceTerminalUnlinkGroup(int groupId) { if (isSwapping) return false; log.info("Menu: Unlink terminals in group"); String name = "G/" + groupId; synchronized (doc) { Element eg = DomTools.getElementFromSection(doc, "GroupDefs", "id", String.valueOf(groupId)); name = DomTools.getChildText(eg, "Name", "G/" + groupId, false); }/*from w w w.j av a 2 s. c o m*/ int r = JOptionPane.showConfirmDialog(frame, "Are you sure you want to unlink all terminals in group " + name + "?", "Unlink group?", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (r == JOptionPane.YES_OPTION) { boolean update = false; synchronized (doc) { while (true) { Element ep = DomTools.getElementFromSection(doc, "PlayerSetup", "groupid", String.valueOf(groupId)); if (ep == null) break; unlinkTerminal(ep); update = true; } } if (update) { updateTerminals(ALL, ALL); updateView(); return true; } } return false; }
From source file:GUI.MainWindow.java
private void LookupCVEActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_LookupCVEActionPerformed File save_file = null;/* w w w . j a v a 2s. co m*/ // Ask user where they want to save file boolean proceed = true; int returnVal = this.fileChooser.showSaveDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION) { save_file = fileChooser.getSelectedFile(); System.out.println("==LookupCVEActionPerformed(): " + save_file); if (save_file.exists() == true) { int response = JOptionPane.showConfirmDialog(null, "Are you sure you want to replace existing file?", "Confirm", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (response == JOptionPane.NO_OPTION) { proceed = false; } } if (proceed == true) { save_file.delete(); // wipe original handleCVELookup(save_file); } } }
From source file:com.pironet.tda.TDA.java
/** * close all open dumps/*w w w .j a v a 2 s.c om*/ */ private void closeAllDumps() { Object[] options = { "Close all", "Cancel close" }; int selectValue = JOptionPane.showOptionDialog(null, "<html><body>Are you sure, you want to close all open dump files", "Confirm closing...", JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[0]); // if first option "close file" is selected. if (selectValue == 0) { // remove stuff from the top nodes topNodes = new Vector<>(); // simply do a re-init, as there is anything to display resetMainPanel(); } }
From source file:org.jets3t.apps.cockpit.Cockpit.java
/** * Adds a bucket not owned by the current S3 user to the bucket listing, after * prompting the user for the name of the bucket to add. * To be added in this way, the third-party bucket must be publicly available. * *//*from w w w. j a va 2s . c om*/ private void addThirdPartyBucket() { try { String bucketName = JOptionPane.showInputDialog(ownerFrame, "Name for third-party bucket:", "Add a third-party bucket", JOptionPane.QUESTION_MESSAGE); if (bucketName != null) { if (s3ServiceMulti.getS3Service().isBucketAccessible(bucketName)) { S3Bucket thirdPartyBucket = new S3Bucket(bucketName); bucketTableModel.addBucket(thirdPartyBucket, false); } else { String message = "Unable to access third-party bucket: " + bucketName; log.error(message); ErrorDialog.showDialog(ownerFrame, this, message, null); } } } catch (RuntimeException e) { throw e; } catch (Exception e) { String message = "Unable to access third-party bucket"; log.error(message, e); ErrorDialog.showDialog(ownerFrame, this, message, e); } }
From source file:edu.ku.brc.specify.tasks.InteractionsTask.java
/** * Asks if they want to delete and then deletes it * @param cmdActionDB the delete command *//* ww w .ja v a 2s . c om*/ private void deleteInfoRequest(final CommandActionForDB cmdActionDB) { NavBoxButton nb = (NavBoxButton) cmdActionDB.getSrcObj(); int option = JOptionPane.showOptionDialog(UIRegistry.getMostRecentWindow(), String.format(getResourceString("InteractionsTask.CONFIRM_DELETE_IR"), nb.getName()), getResourceString("InteractionsTask.CONFIRM_DELETE_TITLE_IR"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, JOptionPane.NO_OPTION); // I18N if (option == JOptionPane.YES_OPTION) { InfoRequest infoRequest = deleteInfoRequest(cmdActionDB.getId()); deleteInfoRequestFromUI(null, infoRequest); } }
From source file:net.sf.jabref.gui.BasePanel.java
public boolean showDeleteConfirmationDialog(int numberOfEntries) { if (Globals.prefs.getBoolean(JabRefPreferences.CONFIRM_DELETE)) { String msg;//w ww . ja v a 2 s. c o m msg = Localization.lang("Really delete the selected entry?"); String title = Localization.lang("Delete entry"); if (numberOfEntries > 1) { msg = Localization.lang("Really delete the %0 selected entries?", Integer.toString(numberOfEntries)); title = Localization.lang("Delete multiple entries"); } CheckBoxMessage cb = new CheckBoxMessage(msg, Localization.lang("Disable this confirmation dialog"), false); int answer = JOptionPane.showConfirmDialog(frame, cb, title, JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (cb.isSelected()) { Globals.prefs.putBoolean(JabRefPreferences.CONFIRM_DELETE, false); } return answer == JOptionPane.YES_OPTION; } else { return true; } }
From source file:com.lfv.lanzius.server.LanziusServer.java
public boolean menuChoiceGroupStart(int groupId, boolean confirm, String timeStr) { if (isSwapping) return false; log.info("logPath =" + logPath); log.info("Menu: Start group time=" + timeStr); // Debug autostart group if (Config.SERVER_AUTOSTART_GROUP > 0) groupId = Config.SERVER_AUTOSTART_GROUP; boolean showConfirmDialog = (groupId != 0) && confirm; // Select dialog if no group id specified if (groupId == 0) { GroupSelectDialog dlg = new GroupSelectDialog(frame, doc, "Start group..."); groupId = dlg.showDialog();/* w w w .j a v a 2 s .co m*/ } if (groupId > 0) { Element eg = null; if (showConfirmDialog && (Config.SERVER_AUTOSTART_GROUP == 0)) { String name = "G/" + groupId; synchronized (doc) { eg = DomTools.getElementFromSection(doc, "GroupDefs", "id", String.valueOf(groupId)); name = DomTools.getChildText(eg, "Name", "G/" + groupId, false); } int r = JOptionPane.showConfirmDialog(frame, "Are you sure you want to start group " + name + "?", "Start group?", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (r != JOptionPane.YES_OPTION) return false; } synchronized (doc) { if (eg == null) eg = DomTools.getElementFromSection(doc, "GroupDefs", "id", String.valueOf(groupId)); String state = DomTools.getAttributeString(eg, "state", "stopped", false); if (state.equals("stopped")) { if (eg != null) { eg.setAttribute("state", "started"); updateTerminals(ALL, groupId); updateView(); if (logEvents) { ServerLogger logger = new ServerLogger(groupId, logPath); try { logger.resume(Integer.parseInt(timeStr.substring(0, 2)), Integer.parseInt(timeStr.substring(3, 5)), Integer.parseInt(timeStr.substring(6, 8))); } catch (Exception e) { logger.resume(); } loggerMap.put(groupId, logger); logger.print("GROUP START id[" + groupId + "]"); } return true; } } else if (state.equals("paused")) { eg.setAttribute("state", "started"); updateView(); ServerLogger logger = loggerMap.get(groupId); if (logger != null) { try { logger.resume(Integer.parseInt(timeStr.substring(0, 2)), Integer.parseInt(timeStr.substring(3, 5)), Integer.parseInt(timeStr.substring(6, 8))); } catch (Exception e) { logger.resume(); } logger.print("GROUP CONTINUE id[" + groupId + "]"); } return true; } else { if (confirm) { JOptionPane.showMessageDialog(frame, "Group is already started!", "Info!", JOptionPane.INFORMATION_MESSAGE); } ServerLogger logger = loggerMap.get(groupId); if (logger != null) { try { logger.resume(Integer.parseInt(timeStr.substring(0, 2)), Integer.parseInt(timeStr.substring(3, 5)), Integer.parseInt(timeStr.substring(6, 8))); } catch (Exception e) { logger.resume(); } } } } } return false; }