List of usage examples for javax.swing JOptionPane INFORMATION_MESSAGE
int INFORMATION_MESSAGE
To view the source code for javax.swing JOptionPane INFORMATION_MESSAGE.
Click Source Link
From source file:com.compomics.cell_coord.gui.controller.load.LoadTracksController.java
/** * Initialize the view components.// w w w .j av a 2s . co m */ private void initView() { // create new view loadTracksPanel = new LoadTracksPanel(); // disable the IMPORT FILES button loadTracksPanel.getImportFilesButton().setEnabled(false); // initialize the flag to keep track of importing isImported = false; // populate the combobox with available file formats // note: these are annoatated as spring beans Set<String> parsers = TrackFileParserFactory.getInstance().getParserBeanNames(); for (String parser : parsers) { loadTracksPanel.getFileFormatComboBox().addItem(parser); } // format the table JTableHeader tracksTableHeader = loadTracksPanel.getTracksTable().getTableHeader(); tracksTableHeader.setBackground(GuiUtils.getHeaderColor()); tracksTableHeader.setFont(GuiUtils.getHeaderFont()); tracksTableHeader.setReorderingAllowed(false); /** * Action Listeners. */ // load directory loadTracksPanel.getLoadDirectoryButton().addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (directory == null) { chooseDirectoryAndLoadData(); } else { // otherwise we ask the user if they want to reload the directory Object[] options = { "Load a different directory", "Cancel" }; int showOptionDialog = JOptionPane.showOptionDialog(null, "It seems a directory was already loaded.\nWhat do you want to do?", "", JOptionPane.CANCEL_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[1]); switch (showOptionDialog) { case 0: // load a different directory: // reset the model of the directory tree DefaultTreeModel model = (DefaultTreeModel) loadTracksPanel.getDirectoryTree().getModel(); DefaultMutableTreeNode rootNote = (DefaultMutableTreeNode) model.getRoot(); rootNote.removeAllChildren(); model.reload(); chooseDirectoryAndLoadData(); loadTracksPanel.getChosenDirectoryTextArea().setText(directory.getAbsolutePath()); break; // cancel: do nothing } } } }); // import the selected files in the tree loadTracksPanel.getImportFilesButton().addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { // check if an import already took place if (!isImported) { // get the selected file(s) from the JTree TreePath[] selectionPaths = loadTracksPanel.getDirectoryTree().getSelectionPaths(); if (selectionPaths != null && selectionPaths.length != 0) { // at least a file was selected -- proceed with the import importFiles(); isImported = true; cellCoordController.showMessage(selectionPaths.length + " file(s) successfully imported!", "success loading", JOptionPane.INFORMATION_MESSAGE); // do basic computations preprocess(); // go to child controllers and show samples in the tables summaryDataController.showSamplesInTable(); computationMainController.showSamplesInTable(); // proceed with next step in the plugin cellCoordController.getCellCoordFrame().getNextButton().setEnabled(true); } else { // inform the user that no file was selected! cellCoordController.showMessage("You have to select at least one file!", "no files selected", JOptionPane.WARNING_MESSAGE); } } else { // an import already took place: ask for user input Object[] options = { "Load other file(s)", "Cancel" }; int showOptionDialog = JOptionPane.showOptionDialog(loadTracksPanel, "It seems some files were already loaded.\nWhat do you want to do?", "", JOptionPane.CANCEL_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[1]); switch (showOptionDialog) { case 0: // load other files // clear the sample list samples.clear(); // clear the track spot list trackSpotsBindingList.clear(); // clear the selection in the JTree loadTracksPanel.getDirectoryTree().clearSelection(); isImported = false; // inform the user they need to select other files JOptionPane.showMessageDialog(loadTracksPanel, "Please select other files", "", JOptionPane.INFORMATION_MESSAGE); break; // cancel: do nothing } } } }); // add view to parent component cellCoordController.getCellCoordFrame().getLoadTracksParentPanel().add(loadTracksPanel, gridBagConstraints); }
From source file:com.clank.launcher.dialog.LauncherFrame.java
private void selfUpdate() { URL url = updateUrl;// w ww . ja v a 2 s. c o m if (url != null) { SelfUpdater downloader = new SelfUpdater(launcher, url); ObservableFuture<File> future = new ObservableFuture<File>(launcher.getExecutor().submit(downloader), downloader); Futures.addCallback(future, new FutureCallback<File>() { @Override public void onSuccess(File result) { selfUpdateButton.setVisible(false); SwingHelper.showMessageDialog(LauncherFrame.this, _("launcher.selfUpdateComplete"), _("launcher.selfUpdateCompleteTitle"), null, JOptionPane.INFORMATION_MESSAGE); } @Override public void onFailure(Throwable t) { } }, SwingExecutor.INSTANCE); ProgressDialog.showProgress(this, future, _("launcher.selfUpdatingTitle"), _("launcher.selfUpdatingStatus")); SwingHelper.addErrorDialogCallback(this, future); } else { selfUpdateButton.setVisible(false); } }
From source file:net.sf.keystore_explorer.gui.actions.ExportKeyPairPrivateKeyAction.java
private void exportAsPvk(PrivateKey privateKey, String alias) throws CryptoException, IOException { File exportFile = null;// w w w . java2s . c o m try { DExportPrivateKeyPvk dExportPrivateKeyPvk = new DExportPrivateKeyPvk(frame, alias, privateKey, applicationSettings.getPasswordQualityConfig()); dExportPrivateKeyPvk.setLocationRelativeTo(frame); dExportPrivateKeyPvk.setVisible(true); if (!dExportPrivateKeyPvk.exportSelected()) { return; } exportFile = dExportPrivateKeyPvk.getExportFile(); int keyType = dExportPrivateKeyPvk.getKeyType(); boolean encrypt = dExportPrivateKeyPvk.encrypt(); boolean strongEncryption = false; Password exportPassword = null; if (encrypt) { strongEncryption = dExportPrivateKeyPvk.useStrongEncryption(); exportPassword = dExportPrivateKeyPvk.getExportPassword(); } byte[] encoded = getPvkEncodedPrivateKey(privateKey, keyType, exportPassword, strongEncryption); exportEncodedPrivateKey(encoded, exportFile); JOptionPane.showMessageDialog(frame, res.getString("ExportKeyPairPrivateKeyAction.ExportPrivateKeyPvkSuccessful.message"), res.getString("ExportKeyPairPrivateKeyAction.ExportPrivateKeyPvk.Title"), JOptionPane.INFORMATION_MESSAGE); } catch (FileNotFoundException ex) { String message = MessageFormat .format(res.getString("ExportKeyPairPrivateKeyAction.NoWriteFile.message"), exportFile); JOptionPane.showMessageDialog(frame, message, res.getString("ExportKeyPairPrivateKeyAction.ExportPrivateKeyPvk.Title"), JOptionPane.WARNING_MESSAGE); } }
From source file:com.compomics.colims.client.controller.AnalyticalRunsSearchSettingsController.java
@Override @PostConstruct/*www . ja v a 2 s .c o m*/ public void init() { //register to event bus eventBus.register(this); analyticalRunsSearchSettingsDialog = new AnalyticalRunsSearchSettingsDialog(mainController.getMainFrame(), true); //init sample analytical runs table SortedList<AnalyticalRun> sortedAnalyticalRuns = new SortedList<>(analyticalRuns, new IdComparator()); analyticalRunsTableModel = GlazedListsSwing.eventTableModel(sortedAnalyticalRuns, new AnalyticalRunManagementTableFormat()); analyticalRunsSearchSettingsDialog.getAnalyticalRunsTable().setModel(analyticalRunsTableModel); analyticalRunsSelectionModel = new DefaultEventSelectionModel<>(sortedAnalyticalRuns); analyticalRunsSelectionModel.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); analyticalRunsSearchSettingsDialog.getAnalyticalRunsTable().setSelectionModel(analyticalRunsSelectionModel); //set column widths analyticalRunsSearchSettingsDialog.getAnalyticalRunsTable().getColumnModel() .getColumn(AnalyticalRunManagementTableFormat.RUN_ID).setPreferredWidth(35); analyticalRunsSearchSettingsDialog.getAnalyticalRunsTable().getColumnModel() .getColumn(AnalyticalRunManagementTableFormat.RUN_ID).setMaxWidth(35); analyticalRunsSearchSettingsDialog.getAnalyticalRunsTable().getColumnModel() .getColumn(AnalyticalRunManagementTableFormat.RUN_ID).setMinWidth(35); analyticalRunsSearchSettingsDialog.getAnalyticalRunsTable().getColumnModel() .getColumn(AnalyticalRunManagementTableFormat.NAME).setPreferredWidth(200); analyticalRunsSearchSettingsDialog.getAnalyticalRunsTable().getColumnModel() .getColumn(AnalyticalRunManagementTableFormat.START_DATE).setPreferredWidth(80); analyticalRunsSearchSettingsDialog.getAnalyticalRunsTable().getColumnModel() .getColumn(AnalyticalRunManagementTableFormat.START_DATE).setMaxWidth(80); analyticalRunsSearchSettingsDialog.getAnalyticalRunsTable().getColumnModel() .getColumn(AnalyticalRunManagementTableFormat.START_DATE).setMinWidth(80); analyticalRunsSearchSettingsDialog.getAnalyticalRunsTable().getColumnModel() .getColumn(AnalyticalRunManagementTableFormat.CREATED).setPreferredWidth(80); analyticalRunsSearchSettingsDialog.getAnalyticalRunsTable().getColumnModel() .getColumn(AnalyticalRunManagementTableFormat.CREATED).setMaxWidth(80); analyticalRunsSearchSettingsDialog.getAnalyticalRunsTable().getColumnModel() .getColumn(AnalyticalRunManagementTableFormat.CREATED).setMinWidth(80); analyticalRunsSearchSettingsDialog.getAnalyticalRunsTable().getColumnModel() .getColumn(AnalyticalRunManagementTableFormat.NUMBER_OF_SPECTRA).setPreferredWidth(80); analyticalRunsSearchSettingsDialog.getAnalyticalRunsTable().getColumnModel() .getColumn(AnalyticalRunManagementTableFormat.NUMBER_OF_SPECTRA).setMaxWidth(80); analyticalRunsSearchSettingsDialog.getAnalyticalRunsTable().getColumnModel() .getColumn(AnalyticalRunManagementTableFormat.NUMBER_OF_SPECTRA).setMinWidth(80); analyticalRunsSearchSettingsDialog.getEditAnalyticalRunButton().addActionListener(e -> { EventList<AnalyticalRun> selectedAnalyticalRuns = analyticalRunsSelectionModel.getSelected(); if (selectedAnalyticalRuns.size() == 1) { analyticalRunEditController.updateView(selectedAnalyticalRuns.get(0)); } else { eventBus.post(new MessageEvent("Analytical run selection", "Please select one and only one analytical run to edit.", JOptionPane.INFORMATION_MESSAGE)); } }); analyticalRunsSearchSettingsDialog.getDeleteAnalyticalRunButton().addActionListener(e -> { EventList<AnalyticalRun> selectedAnalyticalRuns = analyticalRunsSelectionModel.getSelected(); if (selectedAnalyticalRuns.size() == 1) { boolean deleteConfirmation = deleteEntity(selectedAnalyticalRuns.get(0), AnalyticalRun.class); if (deleteConfirmation) { AnalyticalRun selectedAnalyticalRun = selectedAnalyticalRuns.get(0); //remove from overview table and clear selection analyticalRuns.remove(selectedAnalyticalRun); analyticalRunsSelectionModel.clearSelection(); eventBus.post(new AnalyticalRunChangeEvent(EntityChangeEvent.Type.DELETED, selectedAnalyticalRun.getId(), sampleToEdit.getId())); //remove analytical run from the selected sample and update the table sampleToEdit.getAnalyticalRuns().remove(selectedAnalyticalRun); analyticalRunsSearchSettingsDialog.getAnalyticalRunsTable().updateUI(); } } else { eventBus.post(new MessageEvent("Analytical run selection", "Please select one and only one analytical run to delete.", JOptionPane.INFORMATION_MESSAGE)); } }); analyticalRunsSelectionModel.addListSelectionListener(lse -> { if (!lse.getValueIsAdjusting()) { AnalyticalRun analyticalRun = getSelectedAnalyticalRun(); setAnalyticalRunDetailsSearchSettings(analyticalRun); } }); analyticalRunsSearchSettingsDialog.getCloseButton() .addActionListener(e -> analyticalRunsSearchSettingsDialog.dispose()); }
From source file:de.tntinteractive.portalsammler.gui.MainDialog.java
private void poll(final Gui gui) { this.pollButton.setEnabled(false); final Settings settings = this.getStore().getSettings().deepClone(); final ProgressMonitor progress = new ProgressMonitor(this, "Sammle Daten aus den Quell-Portalen...", "...", 0, settings.getSize());//from w ww . j av a 2 s. c o m progress.setMillisToDecideToPopup(0); progress.setMillisToPopup(0); progress.setProgress(0); final SwingWorker<String, String> task = new SwingWorker<String, String>() { @Override protected String doInBackground() throws Exception { final StringBuilder summary = new StringBuilder(); int cnt = 0; for (final String id : settings.getAllSettingIds()) { if (this.isCancelled()) { break; } cnt++; this.publish(cnt + ": " + id); final Pair<Integer, Integer> counts = MainDialog.this.pollSingleSource(settings, id); summary.append(id).append(": "); if (counts != null) { summary.append(counts.getLeft()).append(" neu, ").append(counts.getRight()) .append(" schon bekannt\n"); } else { summary.append("Fehler!\n"); } this.setProgress(cnt); } MainDialog.this.getStore().writeMetadata(); return summary.toString(); } @Override protected void process(final List<String> ids) { progress.setNote(ids.get(ids.size() - 1)); } @Override public void done() { MainDialog.this.pollButton.setEnabled(true); MainDialog.this.table.refreshContents(); try { final String summary = this.get(); JOptionPane.showMessageDialog(MainDialog.this, summary, "Abruf-Zusammenfassung", JOptionPane.INFORMATION_MESSAGE); } catch (final Exception e) { gui.showError(e); } } }; task.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(final PropertyChangeEvent evt) { if ("progress".equals(evt.getPropertyName())) { progress.setProgress((Integer) evt.getNewValue()); } if (progress.isCanceled()) { task.cancel(true); } } }); task.execute(); }
From source file:com.bsoft.baseframe.baseframe_utils.beanUtils.Classgenerator.java
/** * ?// w w w . j a v a 2 s.c om * @param msg_code int */ private void showMsg(int msg_code) { String message = ""; boolean flag = false; switch (msg_code) { case 0: flag = true; message = "???"; break; case 1: message = "?????"; break; case 2: message = "??"; break; case 3: message = "XML??"; break; case 4: message = "????"; break; case 5: message = "???"; break; } JOptionPane.showMessageDialog(this, message, "", JOptionPane.WARNING_MESSAGE); if (flag) { int closable = JOptionPane.showConfirmDialog(null, "???\n??", "??", JOptionPane.YES_NO_OPTION, JOptionPane.INFORMATION_MESSAGE); if (JOptionPane.YES_OPTION == closable) { System.exit(0); } return; } }
From source file:de.whiledo.iliasdownloader2.swing.service.MainController.java
private void handleFirstStart() { if (!ServiceFunctions.getPropertiesFile().exists()) { JOptionPane.showMessageDialog(mainFrame, "Willkommen bei " + APP_NAME, "Willkommen", JOptionPane.INFORMATION_MESSAGE); JPanel panel = new JPanel(new BorderLayout()); panel.add(new JLabel("<html>Wenn Sie " + APP_NAME + " nutzen mchten, mssen Sie die folgende Punkte akzeptieren." + "<ul>" + "<li>This software is under the GNU GENERAL PUBLIC LICENSE Version 3.<br>" + "View https://github.com/kekru/ILIASDownloader2/blob/master/LICENSE for detailed information." + "</li>" + "<li>Dieses Programm wird Ihr Passwort nicht speichern</li>" + "<li>Dieses Programm wird Ihren Loginnamen und Ihr Passwort nur an den von Ihnen angegebenen Server senden</li>" + "<li>Ihr Passwort wird im Arbeitsspeicher dieses Computers <b>nicht</b> verschlsselt gespeichert.<br>Ein Schadprogramm knnte den Arbeitsspeicher auslesen und so an Ihre Logindaten gelangen.<br>Der Autor von " + APP_NAME + " bernimmt keine Verantwortung fr die Sicherheit Ihrer Logindaten</li>" + "<li>Im nchsten Schritt mssen Sie Ihren Ilias Server eingeben. Bitte achten Sie darauf, dass die Adresse mit 'https://' beginnt.<br>Das bewirkt eine gesicherte Verbindung zwischen " + APP_NAME + " und Ihrem Ilias Server</li>" + "<li>Die Nutzung und die Weitergabe von " + APP_NAME + " ist kostenlos.</li>" + "<li>Beim Programmstart wird auf Updates berprft. Dabei wird lediglich der Programmname an den Updateserver gesendet. Ihre Logindaten oder andere persnliche Daten werden nicht bertragen.<br>Wenn Sie die Updatefunktion ausschalten mchten, starten Sie das Programm mit dem Parameter '" + StartGui.NO_UPDATER + "'</li>" + "</ul>" + "</html>"), BorderLayout.NORTH); JButton licenseButton = new JButton("Open GNU GENERAL PUBLIC LICENSE Version 3"); licenseButton.addActionListener(new ActionListener() { @Override/*from w ww. j a va2s .c om*/ public void actionPerformed(ActionEvent e) { openWebsiteLicense(); } }); panel.add(licenseButton, BorderLayout.CENTER); JCheckBox checkboxAccept = new JCheckBox( "Ich akzeptiere die hier aufgefhrten Bedingungen/I accept these agreements."); checkboxAccept.setSelected(false); panel.add(checkboxAccept, BorderLayout.SOUTH); if (JOptionPane.OK_OPTION == JOptionPane.showConfirmDialog(mainFrame, panel, "Bedingungen", JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE) && checkboxAccept.isSelected()) { chooseServer(); } else { System.exit(0); } } }
From source file:com.sec.ose.osi.thread.ui_related.UserRequestHandler.java
public UIResponseObserver handle(int pRequestCode, UIEntity pEntity, boolean pDisplayProgress, boolean pShowSuccessResult) { final int NUMBER_THREADS = 2; ExecutorService executorService = Executors.newFixedThreadPool(NUMBER_THREADS); UIResponseObserver observer = new DefaultUIResponseObserver(); UserCommandExecutionThread xExecutionThread = new UserCommandExecutionThread(pRequestCode, pEntity, observer);/* www . j ava 2s .c o m*/ // Option 1: // in case: pDisplayProgress == true // need to display progress dialog if (pDisplayProgress == true) { // 1-1. create Progress Dialog ProgressDisplayer progressDisplayer = ProgressDisplayerFactory .getProgressDisplayer(UISharedData.getInstance().getCurrentFrame(), pRequestCode); // 1-2. Execute Monitor Thread UserCommandExecutionMonitorThread xMonitorThread = new UserCommandExecutionMonitorThread( progressDisplayer, observer); xExecutionThread.setMonitorThread(xMonitorThread); // 1-3. execute executorService.execute(xMonitorThread); executorService.execute(xExecutionThread); progressDisplayer.setVisible(true); // block here // 1-5. close remained thread if (progressDisplayer.isCancled() == true && xExecutionThread.isDone() == false) { log.debug("canceled"); xExecutionThread.cancel(); log.debug("isDone: " + xExecutionThread.isDone()); xExecutionThread = null; observer.setFailMessage("canceled"); executorService.shutdown(); return observer; } } // Option 2: // in case: pDisplayProgress == false // no need to display progress dialog else { // 2-1. execute executorService.execute(xExecutionThread); // 2-2. waiting for completing execution while (xExecutionThread.isDone() == false) { try { Thread.sleep(100); } catch (InterruptedException e) { log.warn(e); } } } // Mandatory STEP // display result int result = observer.getResult(); // opt1. the execution result is "SUCCESS" if (result == UIResponseObserver.RESULT_SUCCESS) { if (pShowSuccessResult == true) { JOptionPane.showMessageDialog(UISharedData.getInstance().getCurrentFrame(), observer.getSuccessMessage(), ProgressDictionary.getSuccessTitle(pRequestCode), JOptionPane.INFORMATION_MESSAGE); } } // opt2. if the execution result is "FAIL" or else else { if (pShowSuccessResult == true) { JOptionPane.showMessageDialog(UISharedData.getInstance().getCurrentFrame(), observer.getFailMessage(), ProgressDictionary.getErrorTitle(pRequestCode), JOptionPane.ERROR_MESSAGE); } } executorService.shutdown(); return observer; }
From source file:jpad.MainEditor.java
public void saveFile(String fileToSave) { try {/* ww w .j av a 2s. c o m*/ if (!hasSavedToFile) saveAs(); String docText = mainTextArea.getText(); File file = new File(curFile); FileUtils.writeStringToFile(file, docText); hasChanges = false; JOptionPane.showMessageDialog(this, String.format("File saved to %s successfully!", curFile), "Information", JOptionPane.INFORMATION_MESSAGE); JRootPane root = this.getRootPane(); root.putClientProperty("Window.documentModified", Boolean.FALSE); root.putClientProperty("Window.documentFile", new File(curFile)); hasChanges = false; hasSavedToFile = true; this.setTitle(String.format("JPad - %s", curFile)); } catch (IOException ex) { Logger.getLogger(MainEditor.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:de.ipk_gatersleben.ag_nw.graffiti.plugins.gui.webstart.MainM.java
/** * Constructs a new instance of the editor. * @param addPluginFile/*from www . j av a 2s . c om*/ */ 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); }