List of usage examples for javax.swing JOptionPane NO_OPTION
int NO_OPTION
To view the source code for javax.swing JOptionPane NO_OPTION.
Click Source Link
From source file:com.vsquaresystem.safedeals.readyreckoner.ReadyReckonerService.java
public Boolean checkExistingDataa() throws IOException { logger.info("check ke andar hai bhai??"); Vector checkCellVectorHolder = read(); logger.info("checkCellVectorHolder line116 :{}", checkCellVectorHolder); logger.info("read in check line117 :{}", read()); int excelSize = checkCellVectorHolder.size() - 1; System.out.println("excelSize" + excelSize); List<Readyreckoner> rs = readyReckonerDAL.getAll(); JFrame parent = new JFrame(); System.out.println("rs" + rs); int listSize = rs.size(); logger.info("rsss:::::", listSize); System.out.println("rsss:::::" + listSize); if (excelSize == listSize || excelSize > listSize) { JDialog.setDefaultLookAndFeelDecorated(true); int response = JOptionPane.showConfirmDialog(null, "Do you want to continue?", "Confirm", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); switch (response) { case JOptionPane.NO_OPTION: System.out.println("No button clicked"); JOptionPane.showMessageDialog(parent, "upload Cancelled"); break; case JOptionPane.YES_NO_OPTION: saveToDatabase(checkCellVectorHolder); System.out.println("Yes button clicked"); JOptionPane.showMessageDialog(parent, "Saved succesfully"); break; case JOptionPane.CLOSED_OPTION: System.out.println("JOptionPane closed"); break; }/*from w w w .j a va 2 s.co m*/ } else { System.out.println("No selected"); } return true; }
From source file:DialogDemo.java
/** Creates the panel shown by the first tab. */ private JPanel createSimpleDialogBox() { final int numButtons = 4; JRadioButton[] radioButtons = new JRadioButton[numButtons]; final ButtonGroup group = new ButtonGroup(); JButton showItButton = null;//w w w .j a v a 2 s. co m final String defaultMessageCommand = "default"; final String yesNoCommand = "yesno"; final String yeahNahCommand = "yeahnah"; final String yncCommand = "ync"; radioButtons[0] = new JRadioButton("OK (in the L&F's words)"); radioButtons[0].setActionCommand(defaultMessageCommand); radioButtons[1] = new JRadioButton("Yes/No (in the L&F's words)"); radioButtons[1].setActionCommand(yesNoCommand); radioButtons[2] = new JRadioButton("Yes/No " + "(in the programmer's words)"); radioButtons[2].setActionCommand(yeahNahCommand); radioButtons[3] = new JRadioButton("Yes/No/Cancel " + "(in the programmer's words)"); radioButtons[3].setActionCommand(yncCommand); for (int i = 0; i < numButtons; i++) { group.add(radioButtons[i]); } radioButtons[0].setSelected(true); showItButton = new JButton("Show it!"); showItButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String command = group.getSelection().getActionCommand(); // ok dialog if (command == defaultMessageCommand) { JOptionPane.showMessageDialog(frame, "Eggs aren't supposed to be green."); // yes/no dialog } else if (command == yesNoCommand) { int n = JOptionPane.showConfirmDialog(frame, "Would you like green eggs and ham?", "An Inane Question", JOptionPane.YES_NO_OPTION); if (n == JOptionPane.YES_OPTION) { setLabel("Ewww!"); } else if (n == JOptionPane.NO_OPTION) { setLabel("Me neither!"); } else { setLabel("Come on -- tell me!"); } // yes/no (not in those words) } else if (command == yeahNahCommand) { Object[] options = { "Yes, please", "No way!" }; int n = JOptionPane.showOptionDialog(frame, "Would you like green eggs and ham?", "A Silly Question", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[0]); if (n == JOptionPane.YES_OPTION) { setLabel("You're kidding!"); } else if (n == JOptionPane.NO_OPTION) { setLabel("I don't like them, either."); } else { setLabel("Come on -- 'fess up!"); } // yes/no/cancel (not in those words) } else if (command == yncCommand) { Object[] options = { "Yes, please", "No, thanks", "No eggs, no ham!" }; int n = JOptionPane.showOptionDialog(frame, "Would you like some green eggs to go " + "with that ham?", "A Silly Question", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[2]); if (n == JOptionPane.YES_OPTION) { setLabel("Here you go: green eggs and ham!"); } else if (n == JOptionPane.NO_OPTION) { setLabel("OK, just the ham, then."); } else if (n == JOptionPane.CANCEL_OPTION) { setLabel("Well, I'm certainly not going to eat them!"); } else { setLabel("Please tell me what you want!"); } } return; } }); return createPane(simpleDialogDesc + ":", radioButtons, showItButton); }
From source file:de.ipk_gatersleben.ag_nw.graffiti.plugins.gui.webstart.MainM.java
/** * Constructs a new instance of the editor. * @param addPluginFile//ww w. ja v a 2 s .c o m */ public MainM(String applicationName, String[] args, String[] addon, SplashScreenInterface splashScreen, String addPluginFile, final boolean showMainFrame) { setupLogger(); ClassLoader cl = this.getClass().getClassLoader(); String path = this.getClass().getPackage().getName().replace('.', '/'); ImageIcon icon = new ImageIcon(cl.getResource(path + "/vanted_logo.png")); if (splashScreen != null && (splashScreen instanceof DBEsplashScreen)) { ((DBEsplashScreen) splashScreen).setIconImage(icon.getImage()); } splashScreen.setVisible(showMainFrame); GravistoMainHelper.createApplicationSettingsFolder(splashScreen); if (!showMainFrame && !(new File(ReleaseInfo.getAppFolderWithFinalSep() + "license_kegg_accepted")).exists() && !(new File(ReleaseInfo.getAppFolderWithFinalSep() + "license_kegg_rejected")).exists()) { // command line version automatically rejects // kegg try { new File(ReleaseInfo.getAppFolderWithFinalSep() + "license_kegg_rejected").createNewFile(); } catch (Exception e1) { e1.printStackTrace(); } } if (!(new File(ReleaseInfo.getAppFolderWithFinalSep() + "license_kegg_accepted")).exists() && !(new File(ReleaseInfo.getAppFolderWithFinalSep() + "license_kegg_rejected")).exists()) { ReleaseInfo.setIsFirstRun(true); splashScreen.setVisible(false); splashScreen.setText("Request KEGG License Status"); int result = askForEnablingKEGG(); if (result == JOptionPane.YES_OPTION) { try { new File(ReleaseInfo.getAppFolderWithFinalSep() + "license_kegg_accepted").createNewFile(); } catch (IOException e) { ErrorMsg.addErrorMessage(e); } } if (result == JOptionPane.NO_OPTION) { try { new File(ReleaseInfo.getAppFolderWithFinalSep() + "license_kegg_rejected").createNewFile(); } catch (IOException e) { ErrorMsg.addErrorMessage(e); } } if (result == JOptionPane.CANCEL_OPTION) { JOptionPane.showMessageDialog(null, "Startup of VANTED is aborted.", "VANTED Program Features Initialization", JOptionPane.INFORMATION_MESSAGE); System.exit(0); } splashScreen.setVisible(true); } GravistoMainHelper.initApplicationExt(args, splashScreen, cl, addPluginFile, addon); }
From source file:com.seanmadden.net.fast.FastInterpretype.java
public void clearWindows() { boolean windowCleared = false; int selected = JOptionPane.showConfirmDialog(null, "Would you like to save the current conversation before clearing?", "Save before clearing?", JOptionPane.YES_NO_CANCEL_OPTION); if (selected == JOptionPane.YES_OPTION) { windowCleared = saveLogToFile(); } else if (selected == JOptionPane.NO_OPTION) { windowCleared = true;/* w ww. j a v a2s . co m*/ } if (windowCleared) { si.sendRawDataToPort(DataPacket.generateClearConvoPayload()); mw.clearWindow(); String username = JOptionPane.showInputDialog("What is your name?"); si.sendRawDataToPort(DataPacket.generateSignedOnPayload(username)); mw.acceptText(username + " (you) has signed on.\n"); mw.setLocalUserName(username); } }
From source file:edu.ku.brc.af.auth.UserAndMasterPasswordMgr.java
/** * Displays a dialog that is used for changing the Mast Username and Password. * @param username the current user's username * @return true if changed successfully//from w w w.ja va2 s .c om */ public boolean editMasterInfo(final String username, final String dbName, final boolean askForCredentials) { String uNameCached = username != null ? username : usersUserName; usersUserName = username; databaseName = dbName; Boolean isLocal = AppPreferences.getLocalPrefs().getBoolean(getIsLocalPrefPath(true), null); if (isLocal == null) { isLocal = AppPreferences.getLocalPrefs().getBoolean(getIsLocalPrefPath(false), null); } else { AppPreferences.getLocalPrefs().remove(getIsLocalPrefPath(false)); } String masterKey = AppPreferences.getLocalPrefs().get(getMasterPrefPath(true), null); if (StringUtils.isEmpty(masterKey)) { masterKey = AppPreferences.getLocalPrefs().get(getMasterPrefPath(false), null); } else { AppPreferences.getLocalPrefs().remove(getMasterPrefPath(false)); } if (masterKey == null) { if (askForCredentials && askToContForCredentials() == JOptionPane.NO_OPTION) { return false; } } boolean isOK = askForInfo(isLocal, usersUserName, dbName, masterKey); if (StringUtils.isEmpty(usersUserName) && StringUtils.isNotEmpty(uNameCached)) { usersUserName = uNameCached; } return isOK; }
From source file:au.org.ala.delta.intkey.ui.MultiStateInputDialog.java
@Override void handleBtnOKClicked() { int[] selectedIndicies = _list.getSelectedIndices(); // Show confirmation dialog if all of the states have been // selected.//from w w w . j ava 2s .com if (selectedIndicies.length == _list.getModel().getSize()) { int dlgSelection = JOptionPane.showConfirmDialog(this, selectionConfirmationMessage, selectionConfirmationTitle, JOptionPane.YES_NO_OPTION); if (dlgSelection == JOptionPane.NO_OPTION) { return; } } for (int i : selectedIndicies) { _inputData.add(i + 1); } setVisible(false); }
From source file:com.enderville.enderinstaller.ui.Installer.java
private void advanceStep() { step++;/* w w w.j a v a2s .c o m*/ switch (step) { case 1: { String msg = InstallScript.preInstallCheck(); if (msg != null) { //TODO maybe a better way to check for collisions // so that non-conflicting installs doesn't raise this warning msg = msg + "\nThe EnderPack is meant to be installed on a fresh minecraft.jar and mods folder.\n" + "Do you wish to continue, and attempt to install on top of the current minecraft?"; int opt = JOptionPane.showConfirmDialog(this, msg, "Installation Warning", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE); if (opt == JOptionPane.NO_OPTION) { setVisible(false); dispose(); } } File extraFolder = new File(InstallerConfig.getExtraModsFolder()); //Check that the extras folder exists and that it has some mods in it. Otherwise, simply start installing if (extraFolder.exists()) { File[] children = extraFolder.listFiles(); if (children != null) { for (File child : children) { if (child.isDirectory()) { buildOptionsPane(); return; } } } //extras folder was empty, or no mod directories (only files) advanceStep(); } else { //extras folder didn't exist. advanceStep(); } return; } case 2: buildInstallingPane(); return; default: LOGGER.error("Advanced too far"); } }
From source file:com.ssn.event.controller.SSNShareController.java
@Override public void mouseClicked(MouseEvent e) { Object mouseEventObj = e.getSource(); if (mouseEventObj != null && mouseEventObj instanceof JLabel) { JLabel label = (JLabel) mouseEventObj; getShareForm().setCursor(new Cursor(Cursor.WAIT_CURSOR)); // Tracking this sharing event in Google Analytics GoogleAnalyticsUtil.track(SSNConstants.SSN_APP_EVENT_SHARING); Thread thread = null;/*from ww w . ja v a 2s .co m*/ switch (label.getName()) { case "FacebookSharing": thread = new Thread() { boolean isAlreadyLoggedIn = false; @Override public void run() { Set<String> sharedFileList = getFiles(); AccessGrant facebookAccessGrant = getHomeModel().getHomeForm().getFacebookAccessGrant(); if (facebookAccessGrant == null) { try { LoginWithFacebook loginWithFacebook = new LoginWithFacebook(null); loginWithFacebook.setHomeForm(getHomeModel().getHomeForm()); loginWithFacebook.login(); boolean processFurther = false; while (!processFurther) { facebookAccessGrant = getHomeModel().getHomeForm().getFacebookAccessGrant(); if (facebookAccessGrant == null) { Thread.sleep(10000); } else { processFurther = true; isAlreadyLoggedIn = true; } } } catch (InterruptedException ex) { logger.error(ex); } } FacebookConnectionFactory connectionFactory = new FacebookConnectionFactory( SSNConstants.SSN_FACEBOOK_API_KEY, SSNConstants.SSN_FACEBOOK_SECRET_KEY); Connection<Facebook> connection = connectionFactory.createConnection(facebookAccessGrant); Facebook facebook = connection.getApi(); MediaOperations mediaOperations = facebook.mediaOperations(); if (!isAlreadyLoggedIn) { // SSNMessageDialogBox messageDialogBox = new SSNMessageDialogBox(); SSNConfirmationDialogBox confirmeDialog = new SSNConfirmationDialogBox(); FacebookProfile userProfile = facebook.userOperations().getUserProfile(); String userName = ""; if (userProfile != null) { userName = userProfile.getName() != null ? userProfile.getName() : userProfile.getFirstName(); } confirmeDialog.initDialogBoxUI(SSNDialogChoice.NOTIFICATION_DIALOG.getType(), "Confirmation", "", "You are already logged in with " + userName + ", Click OK to continue."); int result = confirmeDialog.getResult(); if (result == JOptionPane.YES_OPTION) { SwingUtilities.invokeLater(new Runnable() { public void run() { SSNMessageDialogBox messageDialogBox = new SSNMessageDialogBox(); messageDialogBox.initDialogBoxUI( SSNDialogChoice.NOTIFICATION_DIALOG.getType(), "Message", "", "Successfully uploaded."); messageDialogBox.setFocusable(true); } }); } else if (result == JOptionPane.NO_OPTION) { AccessGrant facebookAccessGrant1 = null; if (facebookAccessGrant1 == null) { try { LoginWithFacebook loginWithFacebook = new LoginWithFacebook(null); loginWithFacebook.setHomeForm(getHomeModel().getHomeForm()); loginWithFacebook.login(); boolean processFurther = false; while (!processFurther) { facebookAccessGrant1 = getHomeModel().getHomeForm() .getFacebookAccessGrant(); if (facebookAccessGrant1 == null) { Thread.sleep(10000); } else { processFurther = true; //isAlreadyLoggedIn = true; } } connectionFactory = new FacebookConnectionFactory( SSNConstants.SSN_FACEBOOK_API_KEY, SSNConstants.SSN_FACEBOOK_SECRET_KEY); connection = connectionFactory.createConnection(facebookAccessGrant); facebook = connection.getApi(); mediaOperations = facebook.mediaOperations(); } catch (InterruptedException ex) { logger.error(ex); } } } } String[] videoSupported = SSNConstants.SSN_VIDEO_FORMAT_SUPPORTED; final List<String> videoSupportedList = Arrays.asList(videoSupported); for (String file : sharedFileList) { String fileExtension = file.substring(file.lastIndexOf(".") + 1, file.length()); Resource resource = new FileSystemResource(file); if (!videoSupportedList.contains(fileExtension.toUpperCase())) { String output = mediaOperations.postPhoto(resource); } else { String output = mediaOperations.postVideo(resource); } } getShareForm().dispose(); } }; thread.start(); break; case "TwitterSharing": LoginWithTwitter.deniedPermission = false; thread = new Thread() { boolean isAlreadyLoggedIn = false; @Override public void run() { Set<String> sharedFileList = getFiles(); OAuthToken twitterOAuthToken = getHomeModel().getHomeForm().getTwitterOAuthToken(); if (twitterOAuthToken == null) { try { LoginWithTwitter loginWithTwitter = new LoginWithTwitter(null); loginWithTwitter.setHomeForm(getHomeModel().getHomeForm()); loginWithTwitter.login(); boolean processFurther = false; while (!processFurther) { if (LoginWithTwitter.deniedPermission) break; twitterOAuthToken = getHomeModel().getHomeForm().getTwitterOAuthToken(); if (twitterOAuthToken == null) { Thread.sleep(10000); } else { processFurther = true; isAlreadyLoggedIn = true; } } } catch (IOException | InterruptedException ex) { logger.error(ex); } } if (!LoginWithTwitter.deniedPermission) { Twitter twitter = new TwitterTemplate(SSNConstants.SSN_TWITTER_API_KEY, SSNConstants.SSN_TWITTER_SECRET_KEY, twitterOAuthToken.getValue(), twitterOAuthToken.getSecret()); TimelineOperations timelineOperations = twitter.timelineOperations(); if (!isAlreadyLoggedIn) { SSNConfirmationDialogBox confirmeDialog = new SSNConfirmationDialogBox(); TwitterProfile userProfile = twitter.userOperations().getUserProfile(); String userName = ""; if (userProfile != null) { userName = twitter.userOperations().getScreenName() != null ? twitter.userOperations().getScreenName() : userProfile.getName(); } confirmeDialog.initDialogBoxUI(SSNDialogChoice.NOTIFICATION_DIALOG.getType(), "Confirmation", "", "You are already logged in with " + userName + ", Click OK to continue."); int result = confirmeDialog.getResult(); if (result == JOptionPane.YES_OPTION) { SwingUtilities.invokeLater(new Runnable() { public void run() { SSNMessageDialogBox messageDialogBox = new SSNMessageDialogBox(); messageDialogBox.initDialogBoxUI( SSNDialogChoice.NOTIFICATION_DIALOG.getType(), "Message", "", "Successfully uploaded."); messageDialogBox.setFocusable(true); } }); } else if (result == JOptionPane.NO_OPTION) { twitterOAuthToken = null; if (twitterOAuthToken == null) { try { LoginWithTwitter loginWithTwitter = new LoginWithTwitter(null); loginWithTwitter.setHomeForm(getHomeModel().getHomeForm()); loginWithTwitter.login(); boolean processFurther = false; while (!processFurther) { twitterOAuthToken = getHomeModel().getHomeForm() .getTwitterOAuthToken(); if (twitterOAuthToken == null) { Thread.sleep(10000); } else { processFurther = true; } } twitter = new TwitterTemplate(SSNConstants.SSN_TWITTER_API_KEY, SSNConstants.SSN_TWITTER_SECRET_KEY, twitterOAuthToken.getValue(), twitterOAuthToken.getSecret()); timelineOperations = twitter.timelineOperations(); } catch (IOException | InterruptedException ex) { logger.error(ex); } } } } for (String file : sharedFileList) { Resource image = new FileSystemResource(file); TweetData tweetData = new TweetData("At " + new Date()); tweetData.withMedia(image); timelineOperations.updateStatus(tweetData); } } else { SSNMessageDialogBox messageDialogBox = new SSNMessageDialogBox(); messageDialogBox.initDialogBoxUI(SSNDialogChoice.NOTIFICATION_DIALOG.getType(), "Alert", "", "User denied for OurHive App permission on twitter."); messageDialogBox.setFocusable(true); } getShareForm().dispose(); } }; thread.start(); break; case "InstagramSharing": break; case "MailSharing": try { String OS = System.getProperty("os.name").toLowerCase(); Set<String> sharedFileList = getFiles(); Set<String> voiceNoteList = new HashSet<String>(); for (String sharedFile : sharedFileList) { String voiceNote = SSNDao.getVoiceCommandPath(new File(sharedFile).getAbsolutePath()); if (voiceNote != null && !voiceNote.isEmpty()) { voiceNoteList.add(voiceNote); } } sharedFileList.addAll(voiceNoteList); String fileFullPath = ""; String caption = ""; if (sharedFileList.size() == 1) { fileFullPath = sharedFileList.toArray(new String[0])[0]; caption = SSMMediaGalleryPanel.readMetaDataForTitle(new File(fileFullPath)); } else if (sharedFileList.size() > 1) { fileFullPath = SSNHelper.createZipFileFromMultipleFiles(sharedFileList); } if (OS.contains("win")) { // String subject = "SSN Subject"; String subject = caption.equals("") ? SSNConstants.SSN_SHARE_WITH_MAIL_SUBJECT : caption; String body = ""; String m = "&subject=%s&body=%s"; String outLookExeDir = "C:\\Program Files\\Microsoft Office\\Office14\\Outlook.exe"; String mailCompose = "/c"; String note = "ipm.note"; String mailBodyContent = "/m"; m = String.format(m, subject, body); String slashA = "/a"; String mailClientConfigParams[] = null; Process startMailProcess = null; mailClientConfigParams = new String[] { outLookExeDir, mailCompose, note, mailBodyContent, m, slashA, fileFullPath }; startMailProcess = Runtime.getRuntime().exec(mailClientConfigParams); OutputStream out = startMailProcess.getOutputStream(); File zipFile = new File(fileFullPath); zipFile.deleteOnExit(); } else if (OS.indexOf("mac") >= 0) { //Process p = Runtime.getRuntime().exec(new String[]{String.format("open -a mail ", fileFullPath)}); Desktop desktop = Desktop.getDesktop(); String mailTo = caption.equals("") ? "?SUBJECT=" + SSNConstants.SSN_SHARE_WITH_MAIL_SUBJECT : caption; URI uriMailTo = null; uriMailTo = new URI("mailto", mailTo, null); desktop.mail(uriMailTo); } this.getShareForm().dispose(); } catch (Exception ex) { logger.error(ex); } break; case "moveCopy": getShareForm().dispose(); File album = new File(SSNHelper.getSsnHiveDirPath()); File[] albumPaths = album.listFiles(); Vector albumNames = new Vector(); for (int i = 0; i < albumPaths.length; i++) { if (!(albumPaths[i].getName().equals("OurHive")) && SSNHelper.lastAlbum != null && !(albumPaths[i].getName().equals(SSNHelper.lastAlbum))) albumNames.add(albumPaths[i].getName()); } if (SSNHelper.lastAlbum != null && !SSNHelper.lastAlbum.equals("OurHive")) albumNames.insertElementAt("OurHive", 0); SSNInputDialogBox inputBox = new SSNInputDialogBox(true, albumNames); inputBox.initDialogBoxUI(SSNDialogChoice.NOTIFICATION_DIALOG.getType(), "Copy Media", "Please Select Album Name"); String destAlbumName = inputBox.getTextValue(); if (StringUtils.isNotBlank(destAlbumName)) { homeModel.moveAlbum(destAlbumName, getFiles()); } } getShareForm().setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }
From source file:net.sf.profiler4j.console.Console.java
/** * @return <code>true</code> if a new project was created (the user could have been * cancelled)//from w ww . ja v a2 s .com */ public boolean newProject() { if (client.isConnected()) { int ret = JOptionPane.showConfirmDialog(mainFrame, "Proceed and disconnect?", "New Profiling Project", JOptionPane.YES_NO_OPTION); if (ret == JOptionPane.NO_OPTION) { return false; } } if (checkUnsavedChanges()) { return false; } if (client.isConnected()) { disconnect(); if (client.isConnected()) { return false; } } Project p = new Project(); ProjectDialog d = new ProjectDialog(mainFrame, this); if (d.edit(p)) { this.project = p; return true; } return false; }
From source file:burlov.ultracipher.swing.SwingGuiApplication.java
public boolean canExit() { if (hasChanges) { /*// www. j a va 2s . c om * Wenn es ungespeicherte Aenderungen gibt, dann Benutzer fragen */ int ret = JOptionPane.showConfirmDialog(getMainFrame(), "Save changes before exit?", "", JOptionPane.YES_NO_CANCEL_OPTION); switch (ret) { case JOptionPane.CANCEL_OPTION: return false; case JOptionPane.NO_OPTION: return true; case JOptionPane.YES_OPTION: /* * Speichern anstossen */ saveDatabase(); /* * Nur wenn Speichern erfolgreich war 'true' zurueckgeben */ return !hasChanges; default: return false; } } else { return true; } }