List of usage examples for javax.swing JOptionPane OK_OPTION
int OK_OPTION
To view the source code for javax.swing JOptionPane OK_OPTION.
Click Source Link
From source file:com.freedomotic.jfrontend.PluginConfigure.java
private void uninstallButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_uninstallButtonActionPerformed Plugin item = (Plugin) cmbPlugin.getSelectedItem(); File boundleRootFolder = item.getFile().getParentFile(); String uninstallCandidates = clients.getClients().stream().filter(client -> client instanceof Plugin) .map(plugin -> (Plugin) plugin) .filter(plugin -> plugin.getFile().getParentFile().equals(boundleRootFolder)) .map(plugin -> "'" + plugin.getName() + "'").collect(Collectors.joining(" ")); String localizedMessage = api.getI18n().msg("confirm_plugin_delete", new Object[] { uninstallCandidates }); int result = JOptionPane.showConfirmDialog(null, new JLabel(localizedMessage), api.getI18n().msg("confirm_deletion_title"), JOptionPane.OK_CANCEL_OPTION); if (result == JOptionPane.OK_OPTION) { pluginsManager.uninstallBundle(item); dispose();/*from w w w . j av a2 s .c o m*/ } }
From source file:edu.harvard.mcz.imagecapture.ImageCaptureApp.java
/** * Carry out actions to set up system after a successful login. *//* w w w.j a v a2 s . c o m*/ public static void doStartUp() { boolean isCurrentAllowed = false; try { isCurrentAllowed = AllowedVersionLifeCycle.isCurrentAllowed(); } catch (HibernateException e) { log.error(e.getMessage(), e); String allowed = AllowedVersionLifeCycle.listAllowedVersions(); if (allowed == null || allowed.trim().length() == 0) { Singleton.getSingletonInstance().getMainFrame() .setStatusMessage("Database does not support this version, schema update needed."); JOptionPane.showMessageDialog(Singleton.getSingletonInstance().getMainFrame(), "The database does not support" + APP_NAME + " version " + APP_VERSION + ". A database schema update to version 1.3 is required.", "Schema Update Required", JOptionPane.OK_OPTION); log.error("Database does not test for versioning. Added in 1.3.0 Schema, and required by " + ImageCaptureApp.APP_VERSION + " Unable to Start"); ImageCaptureApp.exit(EXIT_ERROR); } } if (isCurrentAllowed) { Singleton.getSingletonInstance().getMainFrame().setStatusMessage(ImageCaptureApp.APP_VERSION + " OK"); } else { String allowed = AllowedVersionLifeCycle.listAllowedVersions(); Singleton.getSingletonInstance().getMainFrame() .setStatusMessage("Database does not support version, update needed."); JOptionPane.showMessageDialog(Singleton.getSingletonInstance().getMainFrame(), "The database does not support" + APP_NAME + " version " + APP_VERSION + ". A software update to " + allowed + " is required.", "Update Required", JOptionPane.OK_OPTION); log.error("Database does not allow version " + ImageCaptureApp.APP_VERSION + " Unable to Start"); log.error("Database recognises version(s): " + allowed.toString()); ImageCaptureApp.exit(EXIT_ERROR); } // Setup to store a list of running RunnableJobs. Singleton.getSingletonInstance().setJobList(new RunnableJobTableModel()); Singleton.getSingletonInstance().getMainFrame() .setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); Singleton.getSingletonInstance().getMainFrame().setState(MainFrame.STATE_RUNNING); }
From source file:com.digitexx.ancestry.gui.FrmUpperLowerData.java
private void exit() { if (AppUtility.msgConfirm(this, "Do you want to exit ??") == JOptionPane.OK_OPTION) { frmStep.setVisible(true);//from ww w . ja va2 s . c o m this.dispose(); } }
From source file:junk.gui.HazardDataSetCalcCondorApp.java
public void init() { //Checking for the Authentic user //This pops up a user login window and only authentic user will be able //to use HazardMap Calculation application. UserAuthorizationCheckWindow loginWin = new UserAuthorizationCheckWindow(); while (!loginWin.isLoginSuccess()) { if (!loginWin.isVisible()) loginWin.setVisible(true);// ww w .j a v a2 s . c om } loginWin.dispose(); try { // initialize the control pick list initControlList(); jbInit(); } catch (Exception e) { ExceptionWindow bugWindow = new ExceptionWindow(this, e, "Exception occured while initializing the application " + "Parameters values have not been set yet."); bugWindow.setVisible(true); bugWindow.pack(); } try { initIMRGuiBean(); } catch (RuntimeException e) { JOptionPane.showMessageDialog(this, "Invalid parameter value", e.getMessage(), JOptionPane.ERROR_MESSAGE); return; } try { this.initGriddedRegionGuiBean(); } catch (RegionConstraintException ex) { ExceptionWindow bugWindow = new ExceptionWindow(this, ex, "Exception occured while initializing the region parameters in Hazard Dataset Calc App" + " Parameters values have not been set yet."); bugWindow.setVisible(true); bugWindow.pack(); } this.initIMTGuiBean(); try { this.initERFSelector_GuiBean(); } catch (RuntimeException e) { JOptionPane.showMessageDialog(this, "Could not connect with ERF's", "Error occur in ERF", JOptionPane.OK_OPTION); return; } }
From source file:fxts.stations.transport.tradingapi.TradingServerSession.java
/** * Get User Objects/*from w w w. ja v a2 s .c o m*/ * * @throws Exception aex */ public void getUserObjects() throws Exception { GATEWAY.requestTradingSessionStatus(); beginProcessing(); String value = mTradingSessionStatus.getParameterValue("FORCE_PASSWORD_CHANGE"); if (value != null && "Y".equalsIgnoreCase(value)) { TradeApp tradeApp = TradeApp.getInst(); String msg = "For your security, you are required to change your password."; String title = tradeApp.getResourceManager().getString("IDS_MAINFRAME_SHORT_TITLE"); JOptionPane.showMessageDialog(tradeApp.getMainFrame(), msg, title, JOptionPane.INFORMATION_MESSAGE); ChangePasswordDialog dialog = new ChangePasswordDialog(tradeApp.getMainFrame()); if (dialog.showModal() == JOptionPane.OK_OPTION) { ChangePasswordRequest cpr = new ChangePasswordRequest(); cpr.setOldPassword(dialog.getOldPassword()); cpr.setNewPassword(dialog.getNewPassword()); cpr.setConfirmNewPassword(dialog.getConfirmNewPassword()); cpr.doIt(); } else { throw new GenericException(""); } } Enumeration<TradingSecurity> securities = (Enumeration<TradingSecurity>) mTradingSessionStatus .getSecurities(); MarketDataRequest mdr = new MarketDataRequest(); mdr.setSubscriptionRequestType(SubscriptionRequestTypeFactory.SUBSCRIBE); mdr.setMDEntryTypeSet(MarketDataRequest.MDENTRYTYPESET_BIDASK); while (securities.hasMoreElements()) { TradingSecurity ts = securities.nextElement(); if (ts.getFXCMSubscriptionStatus() == null || IFixDefs.FXCMSUBSCRIPTIONSTATUS_SUBSCRIBE.equals(ts.getFXCMSubscriptionStatus())) { mdr.addRelatedSymbol(ts); } } mRequestID = GATEWAY.sendMessage(mdr); mLogger.debug("mMarketDataRequestID = " + mRequestID); setWaitDialogText(mResMan.getString("IDS_GETTING_OFFERS")); beginProcessing(); mRequestID = GATEWAY.requestAccounts(); mLogger.debug("mAccountMassID = " + mRequestID); setWaitDialogText(mResMan.getString("IDS_GETTING_ACCOUNTS")); beginProcessing(); mRequestID = GATEWAY.requestOpenPositions(); mLogger.debug("mOpenPositionMassID = " + mRequestID); setWaitDialogText(mResMan.getString("IDS_GETTING_OPEN_POSITIONS")); beginProcessing(); mRequestID = GATEWAY.requestOpenOrders(); mLogger.debug("mOpenOrderMassID = " + mRequestID); setWaitDialogText(mResMan.getString("IDS_GETTING_OPEN_ORDERS")); beginProcessing(); mRequestID = GATEWAY.requestClosedPositions(); mLogger.debug("mClosedPositionMassID = " + mRequestID); setWaitDialogText(mResMan.getString("IDS_GETTING_CLOSED_POSITIONS")); beginProcessing(); }
From source file:view.App.java
private void initGUI() { try {// w w w . java2 s .com { jPanel1 = new JPanel(); BorderLayout jPanel1Layout = new BorderLayout(); jPanel1.setLayout(jPanel1Layout); getContentPane().add(jPanel1, BorderLayout.CENTER); jPanel1.setPreferredSize(new java.awt.Dimension(901, 398)); { jPanel2 = new JPanel(); BoxLayout jPanel2Layout = new BoxLayout(jPanel2, javax.swing.BoxLayout.Y_AXIS); jPanel2.setLayout(jPanel2Layout); jPanel1.add(jPanel2, BorderLayout.WEST); jPanel2.setPreferredSize(new java.awt.Dimension(292, 446)); { jPanel5 = new JPanel(); jPanel2.add(jPanel5); jPanel5.setPreferredSize(new java.awt.Dimension(292, 109)); { { jTextArea1 = new JTextArea(); jTextArea1.setWrapStyleWord(true); jTextArea1.setLineWrap(true); DefaultCaret caret = (DefaultCaret) jTextArea1.getCaret(); caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE); jTextArea1.addFocusListener(new FocusAdapter() { public void focusGained(FocusEvent evt) { if (jTable1.getModel().getRowCount() == 0 && !jButton1.isEnabled()) { jButton1.setEnabled(true); jTextArea1.setText(""); } } }); JScrollPane sp = new JScrollPane(); sp.setPreferredSize(new java.awt.Dimension(281, 97)); sp.setViewportView(jTextArea1); jPanel5.add(sp, BorderLayout.CENTER); } } } { jPanel4 = new JPanel(); jPanel2.add(jPanel4); FlowLayout jPanel4Layout = new FlowLayout(); jPanel4Layout.setAlignment(FlowLayout.RIGHT); jPanel4.setPreferredSize(new java.awt.Dimension(292, 45)); jPanel4.setSize(102, 51); jPanel4.setLayout(jPanel4Layout); { jButton1 = new JButton(); jPanel4.add(jButton1); jButton1.setText("Get Quotes"); jButton1.setSize(100, 50); jButton1.setPreferredSize(new java.awt.Dimension(100, 26)); jButton1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { // String tickerStr = jTextArea1.getText(); if (tickerStr.equals("") || tickerStr.equals(null) || tickerStr.equals(" ")) { jTextArea1.setText(" "); return; } StringTokenizer tokenizer = new StringTokenizer(tickerStr, " "); String[] tickers = new String[tokenizer.countTokens()]; int i = 0; while (tokenizer.hasMoreTokens()) { tickers[i] = tokenizer.nextToken(); i++; } try { Controller.getQuotes(tickers); } catch (CloneNotSupportedException e) { JOptionPane.showMessageDialog(jPanel1, " "); } jButton1.setEnabled(false); } }); } } { jPanel6 = new JPanel(); BorderLayout jPanel6Layout = new BorderLayout(); jPanel6.setLayout(jPanel6Layout); jPanel2.add(jPanel6); { jScrollPane1 = new JScrollPane(); jPanel6.add(jScrollPane1, BorderLayout.CENTER); jScrollPane1.setPreferredSize(new java.awt.Dimension(292, 341)); { TableModel jTable1Model = new DefaultTableModel(null, new String[] { "", "MA Value", "", "MA Value" }); jTable1 = new JTable(); jScrollPane1.setViewportView(jTable1); jTable1.setModel(jTable1Model); jTable1.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION); } } } } { jPanel3 = new JPanel(); BorderLayout jPanel3Layout = new BorderLayout(); jPanel3.setLayout(jPanel3Layout); jPanel1.add(jPanel3, BorderLayout.CENTER); { // chart = ChartFactory.createLineChart(" ", "dates", "correlation ratio", null, // PlotOrientation.VERTICAL, true, true, false); // ChartPanel chartPanel = new ChartPanel(chart); // chartPanel.setPreferredSize( new java.awt.Dimension( 560 , 367 ) ); // jPanel3.add(chartPanel); } { } } } this.setSize(966, 531); { jMenuBar1 = new JMenuBar(); setJMenuBar(jMenuBar1); { jMenu3 = new JMenu(); jMenuBar1.add(jMenu3); jMenu3.setText("File"); { // newFileMenuItem = new JMenuItem(); // jMenu3.add(newFileMenuItem); // newFileMenuItem.setText("New"); // newFileMenuItem.addActionListener(new ActionListener() { // public void actionPerformed(ActionEvent evt) { //// jTextArea1.setText(""); //// DefaultTableModel model = (DefaultTableModel)jTable1.getModel(); //// model.setRowCount(0); //// Controller.clearPortfolio(); // } // }); } { jSeparator2 = new JSeparator(); jMenu3.add(jSeparator2); } { exitMenuItem = new JMenuItem(); jMenu3.add(exitMenuItem); exitMenuItem.setText("Exit"); exitMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { int action = JOptionPane.showConfirmDialog(jPanel1, " ?", "Confirm Exit", JOptionPane.OK_CANCEL_OPTION); if (action == JOptionPane.OK_OPTION) System.exit(0); } }); } } { jMenu4 = new JMenu(); jMenuBar1.add(jMenu4); jMenu4.setText("Edit"); { cutMenuItem = new JMenuItem(); jMenu4.add(cutMenuItem); cutMenuItem.setText("Cut"); cutMenuItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { String txt = jTextArea1.getText(); StringSelection selection = new StringSelection(txt); Clipboard clp = Toolkit.getDefaultToolkit().getSystemClipboard(); clp.setContents(selection, null); jTextArea1.setText(""); } }); } { copyMenuItem = new JMenuItem(); jMenu4.add(copyMenuItem); copyMenuItem.setText("Copy"); copyMenuItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { String txt = jTextArea1.getText(); StringSelection selection = new StringSelection(txt); Clipboard clp = Toolkit.getDefaultToolkit().getSystemClipboard(); clp.setContents(selection, null); } }); } { pasteMenuItem = new JMenuItem(); jMenu4.add(pasteMenuItem); pasteMenuItem.setText("Paste"); pasteMenuItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Clipboard clp = Toolkit.getDefaultToolkit().getSystemClipboard(); try { String data = (String) clp.getData(DataFlavor.stringFlavor); jTextArea1.setText(data); } catch (UnsupportedFlavorException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } }); } } { jMenu5 = new JMenu(); jMenuBar1.add(jMenu5); jMenu5.setText("Help"); { helpMenuItem = new JMenuItem(); jMenu5.add(helpMenuItem); helpMenuItem.setText("About"); helpMenuItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { JOptionPane.showMessageDialog(jPanel1, " . r.zhumagulov@gmail.com", "About", JOptionPane.PLAIN_MESSAGE); } }); } } } } catch (Exception e) { e.printStackTrace(); } }
From source file:net.sf.profiler4j.console.ClassListPanel.java
/** * This method initializes addAsRuleButton * /* w w w. j a v a2 s . c o m*/ * @return javax.swing.JButton */ private JButton getAddAsRuleButton() { if (addAsRuleButton == null) { addAsRuleButton = new JButton(); addAsRuleButton .setIcon(new ImageIcon(getClass().getResource("/net/sf/profiler4j/console/images/wand.png"))); addAsRuleButton.setToolTipText("Create rules from classes"); addAsRuleButton.setEnabled(false); addAsRuleButton.setPreferredSize(new java.awt.Dimension(28, 28)); addAsRuleButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { int ret = JOptionPane.showConfirmDialog(ClassListPanel.this, "Create rules from selected classes?", "Question", JOptionPane.YES_NO_OPTION); if (ret == JOptionPane.OK_OPTION) { int i = 0; for (int r : classesTable.getSelectedRows()) { String n = (String) classListTableModel.getRow(r).info.getName(); Rule rule = new Rule(n + ".*(*)", Rule.Action.ACCEPT); app.getProject().getRules().add(i++, rule); } ProjectDialog d = new ProjectDialog(app.getMainFrame(), app); d.edit(app.getProject()); } } }); } return addAsRuleButton; }
From source file:org.apache.jmeter.visualizers.CreateReport.java
@Override public void add(final SampleResult res) { if (testRunning == false) { numSamples = 1;/*from ww w .j a va 2s . c om*/ errorNo = 0; BASEPATH = BASEPATH + "\\" + this.getName() + "_" + GetTimeStampInHMS(); try { File createDir = new File(BASEPATH); createDir.mkdirs(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } summaryCsvFile = BASEPATH + "\\" + "Summary_Report" + "_" + GetTimeStampInHMS() + ".csv"; errorCsvFile = BASEPATH + "\\" + "Error_Report" + "_" + GetTimeStampInHMS() + ".csv"; reportPdfFile = BASEPATH + "\\" + "TestReport" + "_" + GetTimeStampInHMS() + ".pdf"; JOptionPane.showMessageDialog(null, summaryCsvFile, "test started", JOptionPane.OK_OPTION); testRunning = true; } final String sampleLabel = res.getSampleLabel(useGroupName.isSelected()); JMeterUtils.runSafe(new Runnable() { @Override public void run() { Calculator row = null; synchronized (lock) { row = tableRows.get(sampleLabel); if (row == null) { row = new Calculator(sampleLabel); tableRows.put(row.getLabel(), row); model.insertRow(row, model.getRowCount() - 1); } if (!res.isSuccessful()) { synchronized (lock) { addErrorToTable(res); } } saveTable(); } /* * Synch is needed because multiple threads can update the counts. */ synchronized (row) { row.addSample(res); } Calculator tot = tableRows.get(TOTAL_ROW_LABEL); synchronized (tot) { tot.addSample(res); } model.fireTableDataChanged(); } }); }
From source file:sk.uniza.fri.pds.spotreba.energie.gui.MainGui.java
private void increasedSpendingActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_increasedSpendingActionPerformed final IncreasedSpendingStatisticParams params = new IncreasedSpendingStatisticParams(); int option = showUniversalInputDialog(params, "Zven spotreba"); if (option == JOptionPane.OK_OPTION) { new SwingWorker<List, RuntimeException>() { @Override//from w w w . ja v a 2 s . c om protected List doInBackground() throws Exception { try { return SeHistoriaService.getInstance().getIncreasedSpendingStatistics(params, 1.2); } catch (RuntimeException e) { publish(e); return null; } } @Override protected void done() { try { List data = get(); showJTable(ZvysenieSpotreby.class, data); } catch (InterruptedException | ExecutionException ex) { Logger.getLogger(MainGui.class.getName()).log(Level.SEVERE, null, ex); } } @Override protected void process(List<RuntimeException> chunks) { if (chunks.size() > 0) { showException("Chyba", chunks.get(0)); } } }.execute(); } }
From source file:com.sshtools.common.vomanagementtool.common.VOHelper.java
public static boolean checkFavouritesChanges() { boolean isChanged = false; Map favourites = (TreeMap) VOHelper.getVOGroup(FAVOURITES); Map egis = (TreeMap) VOHelper.getVOGroup(EGI); Map others = (TreeMap) VOHelper.getVOGroup(OTHERS); Iterator<Map.Entry<String, List>> entries = favourites.entrySet().iterator(); while (entries.hasNext()) { Entry<String, List> favourite = entries.next(); String favVOName = favourite.getKey(); List voDetails = favourite.getValue(); for (int i = 0; i < voDetails.size(); i++) { TreeMap favInfo = (TreeMap) voDetails.get(i); boolean isSame = false; String group = ""; if (egis.containsKey(favVOName)) { List egiVODetails = (List) egis.get(favVOName); isSame = compareTreeMapInList(favVOName, favInfo, egiVODetails); group = EGI;/*from w w w . j a va2 s . c om*/ } else if (others.containsKey(favVOName)) { List othersVODetails = (List) others.get(favVOName); isSame = compareTreeMapInList(favVOName, favInfo, othersVODetails); group = OTHERS; } if (!isSame && !group.equals("")) { int reply = JOptionPane.showConfirmDialog(null, "VO '" + favVOName + "' setup has been modified in " + group + " setup. Your " + FAVOURITES + " configuration might not work.\n Do you want to update Favourites with the updated configurations?", "Update " + FAVOURITES + " configuration", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, new ResourceIcon(VOHelper.class, ConfigHelper.ICON)); if (reply == JOptionPane.OK_OPTION) { if (group.equals(EGI)) { favourites.put(favVOName, egis.get(favVOName)); isChanged = true; } else if (group.equals(OTHERS)) { favourites.put(favVOName, others.get(favVOName)); isChanged = true; } break; } } } } if (isChanged) { String newContent = createStringFromTreeMap((TreeMap) favourites); try { writeToFile(favouritesFile, newContent); } catch (IOException e) { isChanged = false; JOptionPane.showMessageDialog(null, "Failed to remove VO from Favourites. Cannot write to file '" + favouritesFile + "'", "Error: Remove VO", JOptionPane.ERROR_MESSAGE); } } return isChanged; }