List of usage examples for javax.swing JOptionPane YES_OPTION
int YES_OPTION
To view the source code for javax.swing JOptionPane YES_OPTION.
Click Source Link
From source file:net.pms.newgui.LanguageSelection.java
public void show() { if (PMS.isHeadless()) { // Can only get here during startup in headless mode, there's no way to trigger it from the GUI LOGGER.info(//from ww w .j a v a 2 s . co m "No language is configured and the language selection dialog is unavailable in headless mode"); LOGGER.info("Defaulting to OS locale {}", Locale.getDefault().getDisplayName()); PMS.setLocale(Locale.getDefault()); } else { pane = new JOptionPane(buildComponent(), JOptionPane.PLAIN_MESSAGE, JOptionPane.NO_OPTION, null, new JButton[] { applyButton, selectButton }, selectButton); pane.setComponentOrientation(ComponentOrientation.getOrientation(locale)); dialog = pane.createDialog(parentComponent, PMS.NAME); dialog.setModalityType(ModalityType.APPLICATION_MODAL); dialog.setIconImage(LooksFrame.readImageIcon("icon-32.png").getImage()); setStrings(); dialog.pack(); dialog.setLocationRelativeTo(parentComponent); dialog.setVisible(true); dialog.dispose(); if (pane.getValue() == null) { aborted = true; } else if (!((String) pane.getValue()).equals(PMS.getConfiguration().getLanguageRawString())) { if (rebootOnChange) { int response = JOptionPane.showConfirmDialog(parentComponent, String.format(buildString("Dialog.Restart", true), PMS.NAME, PMS.NAME), buildString("Dialog.Confirm"), JOptionPane.YES_NO_CANCEL_OPTION); if (response != JOptionPane.CANCEL_OPTION) { PMS.getConfiguration().setLanguage((String) pane.getValue()); if (response == JOptionPane.YES_OPTION) { try { PMS.getConfiguration().save(); } catch (ConfigurationException e) { LOGGER.error("Error while saving configuration: {}", e.getMessage()); LOGGER.trace("", e); } ProcessUtil.reboot(); } } } else { PMS.getConfiguration().setLanguage((String) pane.getValue()); } } } }
From source file:gdt.jgui.entity.JEntityStructurePanel.java
/** * The default constructor./*from www .j a v a2 s.co m*/ */ public JEntityStructurePanel() { setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); scrollPane = new JScrollPane(); add(scrollPane); popup = new JPopupMenu(); popup.addPopupMenuListener(new PopupMenuListener() { @Override public void popupMenuWillBecomeVisible(PopupMenuEvent e) { popup.removeAll(); JMenuItem facetsItem = new JMenuItem("Facets"); popup.add(facetsItem); facetsItem.setHorizontalTextPosition(JMenuItem.RIGHT); facetsItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { // System.out.println("EntityStructurePanel:renderer:component locator$="+nodeLocator$); JEntityFacetPanel efp = new JEntityFacetPanel(); String efpLocator$ = efp.getLocator(); Properties locator = Locator.toProperties(selection$); String entihome$ = locator.getProperty(Entigrator.ENTIHOME); String entityKey$ = locator.getProperty(EntityHandler.ENTITY_KEY); efpLocator$ = Locator.append(efpLocator$, Entigrator.ENTIHOME, entihome$); efpLocator$ = Locator.append(efpLocator$, EntityHandler.ENTITY_KEY, entityKey$); JConsoleHandler.execute(console, efpLocator$); } }); JMenuItem copyItem = new JMenuItem("Copy"); popup.add(copyItem); copyItem.setHorizontalTextPosition(JMenuItem.RIGHT); copyItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { console.clipboard.clear(); String locator$ = (String) node.getUserObject(); if (locator$ != null) console.clipboard.putString(locator$); } }); if (!isFirst) { popup.addSeparator(); JMenuItem excludeItem = new JMenuItem("Exclude"); popup.add(excludeItem); excludeItem.setHorizontalTextPosition(JMenuItem.RIGHT); excludeItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { int response = JOptionPane.showConfirmDialog(console.getContentPanel(), "Exclude ?", "Confirm", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (response == JOptionPane.YES_OPTION) { try { Properties locator = Locator.toProperties(selection$); String entihome$ = locator.getProperty(Entigrator.ENTIHOME); String entityKey$ = locator.getProperty(EntityHandler.ENTITY_KEY); Entigrator entigrator = console.getEntigrator(entihome$); Sack component = entigrator.getEntityAtKey(entityKey$); String[] sa = entigrator.ent_listContainers(component); if (sa != null) { Sack container; for (String aSa : sa) { container = entigrator.getEntityAtKey(aSa); if (container != null) entigrator.col_breakRelation(container, component); } } JConsoleHandler.execute(console, JEntityStructurePanel.this.locator$); } catch (Exception ee) { Logger.getLogger(JEntityStructurePanel.class.getName()).info(ee.toString()); } } } }); JMenuItem deleteItem = new JMenuItem("Delete"); popup.add(deleteItem); deleteItem.setHorizontalTextPosition(JMenuItem.RIGHT); 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) { try { Properties locator = Locator.toProperties(selection$); String entihome$ = locator.getProperty(Entigrator.ENTIHOME); String entityKey$ = locator.getProperty(EntityHandler.ENTITY_KEY); Entigrator entigrator = console.getEntigrator(entihome$); Sack component = entigrator.getEntityAtKey(entityKey$); entigrator.deleteEntity(component); JConsoleHandler.execute(console, JEntityStructurePanel.this.locator$); } catch (Exception ee) { Logger.getLogger(JEntityStructurePanel.class.getName()).info(ee.toString()); } } } }); } if (hasToInclude()) { popup.addSeparator(); JMenuItem includeItem = new JMenuItem("Include"); popup.add(includeItem); includeItem.setHorizontalTextPosition(JMenuItem.RIGHT); includeItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { include(); JConsoleHandler.execute(console, JEntityStructurePanel.this.locator$); } }); } } @Override public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { } @Override public void popupMenuCanceled(PopupMenuEvent e) { // TODO Auto-generated method stub } }); }
From source file:com.frostwire.gui.updates.UpdateMediator.java
public void showUpdateMessage() { if (latestMsg == null) { return;/* w w w. j ava 2 s . co m*/ } int result = JOptionPane.showConfirmDialog(null, latestMsg.getMessageInstallerReady(), I18n.tr("Update"), JOptionPane.YES_NO_OPTION, JOptionPane.INFORMATION_MESSAGE); if (result == JOptionPane.YES_OPTION) { startUpdate(); } }
From source file:com.frostwire.gui.updates.InstallerUpdater.java
private void showUpdateMessage() { GUIMediator.safeInvokeLater(new Runnable() { public void run() { if (_executableFile == null) { return; }/*from w w w .ja v a 2s .co m*/ int result = JOptionPane.showConfirmDialog(null, _updateMessage.getMessageInstallerReady(), I18n.tr("Update"), JOptionPane.YES_NO_OPTION, JOptionPane.INFORMATION_MESSAGE); if (result == JOptionPane.YES_OPTION) { try { if (OSUtils.isWindows()) { String[] commands = new String[] { "CMD.EXE", "/C", _executableFile.getAbsolutePath() }; ProcessBuilder pbuilder = new ProcessBuilder(commands); pbuilder.start(); } else if (OSUtils.isLinux() && OSUtils.isUbuntu()) { String[] commands = new String[] { "gdebi-gtk", _executableFile.getAbsolutePath() }; ProcessBuilder pbuilder = new ProcessBuilder(commands); pbuilder.start(); } else if (OSUtils.isMacOSX()) { String[] mountCommand = new String[] { "hdiutil", "attach", _executableFile.getAbsolutePath() }; String[] finderShowCommand = new String[] { "open", "/Volumes/" + FilenameUtils.getBaseName(_executableFile.getName()) }; ProcessBuilder pbuilder = new ProcessBuilder(mountCommand); Process mountingProcess = pbuilder.start(); mountingProcess.waitFor(); pbuilder = new ProcessBuilder(finderShowCommand); pbuilder.start(); } GUIMediator.shutdown(); } catch (Throwable e) { LOG.error("Unable to launch new installer", e); } } } }); }
From source file:de.tor.tribes.ui.algo.SettingsPanel.java
public boolean validatePanel() { boolean result = true; try {/*ww w.ja va 2 s . c om*/ timeSettingsPanel.validateSettings(); } catch (RuntimeException re) { String message = re.getMessage(); if (message == null) { logger.error("Unexpected exception while validating", re); message = "Unerwarteter Fehler bei der Validierung der Einstellungen. Bitte wenden dich an den Support."; } if (message.indexOf("Nachtbonus") > -1 || message.indexOf("Vergangenheit") > -1) { if (JOptionPaneHelper.showQuestionConfirmBox(this, message + "\nMchtest du fortfahren?", "Warnung", "Nein", "Ja") == JOptionPane.YES_OPTION) { result = true; } else { result = false; } } else { JOptionPaneHelper.showWarningBox(this, message, "Fehler"); result = false; } } return result; }
From source file:de.ipk_gatersleben.ag_nw.graffiti.plugins.gui.webstart.KgmlEdMain.java
/** * Constructs a new instance of the editor. *//*from w w w. java 2 s .c om*/ public KgmlEdMain(final boolean showMainFrame, String applicationName, String[] args) { // URL config, final ThreadSafeOptions tso = new ThreadSafeOptions(); SplashScreenInterface splashScreen = new DBEsplashScreen(applicationName, "", new Runnable() { public void run() { if (showMainFrame) { ClassLoader cl = this.getClass().getClassLoader(); String path = this.getClass().getPackage().getName().replace('.', '/'); ImageIcon icon = new ImageIcon(cl.getResource(path + "/ipklogo16x16_5.png")); final MainFrame mainFrame = MainFrame.getInstance(); mainFrame.setIconImage(icon.getImage()); Thread t = new Thread(new Runnable() { public void run() { long waitTime = 0; long start = System.currentTimeMillis(); do { if (ErrorMsg.getAppLoadingStatus() == ApplicationStatus.ADDONS_LOADED) break; try { Thread.sleep(50); } catch (InterruptedException e) { } waitTime = System.currentTimeMillis() - start; } while (waitTime < 2000); SplashScreenInterface ss = (SplashScreenInterface) tso.getParam(0, null); ss.setVisible(false); mainFrame.setVisible(true); } }, "wait for add-on initialization"); t.start(); } } }); tso.setParam(0, splashScreen); ClassLoader cl = this.getClass().getClassLoader(); String path = this.getClass().getPackage().getName().replace('.', '/'); ImageIcon icon = new ImageIcon(cl.getResource(path + "/ipklogo16x16_5.png")); ((DBEsplashScreen) splashScreen).setIconImage(icon.getImage()); splashScreen.setVisible(true); GravistoMainHelper.createApplicationSettingsFolder(splashScreen); 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"); JOptionPane.showMessageDialog(null, "<html><h3>KEGG License Status Evaluation</h3>" + "While " + DBEgravistoHelper.DBE_GRAVISTO_VERSION + " is available as a academic research tool at no cost to commercial and non-commercial users, for using<br>" + "KEGG related functions, it is necessary for all users to adhere to the KEGG license.<br>" + "For using " + DBEgravistoHelper.DBE_GRAVISTO_VERSION + " you need also be aware of information about licenses and conditions for<br>" + "usage, listed at the program info dialog and the " + DBEgravistoHelper.DBE_GRAVISTO_VERSION + " website (" + ReleaseInfo.getAppWebURL() + ").<br><br>" + DBEgravistoHelper.DBE_GRAVISTO_VERSION + " does not distribute information from KEGG but contains functionality for the online-access to information from KEGG wesite.<br><br>" + "<b>Before these functions are available to you, you should carefully read the following license information<br>" + "and decide if it is legit for you to use the KEGG related program functions. If you choose not to use the KEGG functions<br>" + "all other features of this application are still available and fully working.", DBEgravistoHelper.DBE_GRAVISTO_VERSION + " Program Features Initialization", JOptionPane.INFORMATION_MESSAGE); JOptionPane.showMessageDialog(null, "<html><h3>KEGG License Status Evaluation</h3>" + MenuItemInfoDialog.getKEGGlibText(), DBEgravistoHelper.DBE_GRAVISTO_VERSION + " Program Features Initialization", JOptionPane.INFORMATION_MESSAGE); int result = JOptionPane.showConfirmDialog(null, "<html><h3>Enable KEGG functions?", DBEgravistoHelper.DBE_GRAVISTO_VERSION + " Program Features Initialization", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); 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 aborted.", DBEgravistoHelper.DBE_GRAVISTO_VERSION + " Program Features Initialization", JOptionPane.INFORMATION_MESSAGE); System.exit(0); } splashScreen.setVisible(true); } GravistoMainHelper.initApplicationExt(args, splashScreen, cl, null, null); }
From source file:de.tor.tribes.ui.algo.AttackTimePanel.java
private void deleteSelectedTimeSpan() { List selectedValuesList = jTimeFrameList.getSelectedValuesList(); if (selectedValuesList == null || selectedValuesList.isEmpty()) { return;// w w w . ja v a 2 s . c om } List<Object> selection = new LinkedList<>(); for (Object o : jTimeFrameList.getSelectedValuesList()) { if (!(o instanceof TimeSpanDivider)) { selection.add(o); } } if (!selection.isEmpty()) { if (JOptionPaneHelper.showQuestionConfirmBox(this, "Gewhlte Zeitrahmen entfernen?", "Entfernen", "Nein", "Ja") == JOptionPane.YES_OPTION) { for (Object o : selection) { ((DefaultListModel) jTimeFrameList.getModel()).removeElement(o); } } } }
From source file:com.floreantpos.bo.ui.explorer.QuickMaintenanceExplorer.java
private static void quickMaintainMenuGroup(MenuGroup menuGroup) { try {//from w w w . j a v a 2 s.c om if (menuGroup.getId() != null) { if (btnCopy.isSelected()) { MenuGroup newMenuGroup = new MenuGroup(); PropertyUtils.copyProperties(newMenuGroup, menuGroup); newMenuGroup.setId(null); menuGroup = newMenuGroup; } else if (btnDelete.isSelected()) { if (POSMessageDialog.showYesNoQuestionDialog(POSUtil.getFocusedWindow(), POSConstants.CONFIRM_DELETE, POSConstants.DELETE) != JOptionPane.YES_OPTION) { return; } MenuItemDAO menuItemDao = new MenuItemDAO(); List<MenuItem> menuItems = menuItemDao.findByParent(null, menuGroup, true); if (menuItems.size() > 0) { if (POSMessageDialog.showYesNoQuestionDialog(POSUtil.getFocusedWindow(), Messages.getString("MenuGroupExplorer.0"), //$NON-NLS-1$ POSConstants.DELETE) != JOptionPane.YES_OPTION) { return; } menuItemDao.releaseParent(menuItems); } MenuGroupDAO foodGroupDAO = new MenuGroupDAO(); foodGroupDAO.delete(menuGroup); OrderView.getInstance().getGroupView().updateView(menuGroup); return; } } MenuGroupForm editor = new MenuGroupForm(menuGroup); BeanEditorDialog dialog = new BeanEditorDialog(Application.getPosWindow(), editor); dialog.open(); if (dialog.isCanceled()) return; OrderView.getInstance().getGroupView().updateView(menuGroup); return; } catch (Exception e) { return; } }
From source file:canreg.client.gui.management.CanReg4MigrationInternalFrame.java
@Action public void cancelAction() throws RemoteException, IOException { isPaused = true;/*w w w . j a v a 2 s . c om*/ if (cTask != null) { if (JOptionPane.showInternalConfirmDialog( CanRegClientApp.getApplication().getMainFrame().getContentPane(), java.util.ResourceBundle.getBundle("canreg/client/gui/dataentry/resources/ImportView") .getString("REALLY_CANCEL?"), java.util.ResourceBundle.getBundle("canreg/client/gui/dataentry/resources/ImportView") .getString("PLEASE_CONFIRM."), JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) { cTask.cancel(true); JOptionPane.showInternalMessageDialog( CanRegClientApp.getApplication().getMainFrame().getContentPane(), java.util.ResourceBundle.getBundle("canreg/client/gui/dataentry/resources/ImportView") .getString("IMPORT_OF_FILE_INTERUPTED"), java.util.ResourceBundle.getBundle("canreg/client/gui/dataentry/resources/ImportView") .getString("WARNING"), JOptionPane.WARNING_MESSAGE); cTask = null; this.dispose(); } else { isPaused = false; } } else { this.dispose(); } }
From source file:org.cytoscape.dyn.internal.graphMetrics.GraphMetricsResultsPanel.java
/** * //from www . j a v a 2 s. co m */ public void saveData() { JFileChooser saveFileDialog = new JFileChooser(); int save = saveFileDialog.showSaveDialog(null); if (save == JFileChooser.APPROVE_OPTION) { FileWriter writer = null; try { File file = saveFileDialog.getSelectedFile(); if (file.exists()) { if (JOptionPane.showConfirmDialog(null, "The specified file already exists. Do you want to overwrite it?", "Warning - File Exists", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) { writer = new FileWriter(file); for (int i = 0; i < this.dataset.getSeriesCount(); i++) { writer.write(this.dataset.getSeries(i).getKey().toString() + "\n"); for (int j = 0; j < this.dataset.getSeries(i).getItemCount(); j++) { writer.write(this.dataset.getSeries(i).getDataItem(j).toString() + "\n"); } } } } else { writer = new FileWriter(file); for (int i = 0; i < this.dataset.getSeriesCount(); i++) { writer.write(this.dataset.getSeries(i).getKey().toString() + "\n"); for (int j = 0; j < this.dataset.getSeries(i).getItemCount(); j++) { writer.write(this.dataset.getSeries(i).getDataItem(j).toString() + "\n"); } } } } catch (Exception e) { e.printStackTrace(); } try { writer.flush(); writer.close(); } catch (Exception e) { e.printStackTrace(); } } }