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:de.tudarmstadt.ukp.clarin.webanno.webapp.standalone.StandaloneShutdownDialog.java
private void displayShutdownDialog() { String serverId = ServerDetector.getServerId(); log.info("Running in: " + (serverId != null ? serverId : "unknown server")); log.info("Console: " + ((System.console() != null) ? "available" : "not available")); log.info("Headless: " + (GraphicsEnvironment.isHeadless() ? "yes" : "no")); // Show this only when run from the standalone JAR via a double-click if (System.console() == null && !GraphicsEnvironment.isHeadless() && ServerDetector.isWinstone()) { log.info("If you are running WebAnno in a server environment, please use '-Djava.awt.headless=true'"); EventQueue.invokeLater(new Runnable() { @Override/* w ww. j a v a 2 s. co m*/ public void run() { final JOptionPane optionPane = new JOptionPane(new JLabel( "<HTML>WebAnno is running now and can be accessed via <a href=\"http://localhost:8080\">http://localhost:8080</a>.<br>" + "WebAnno works best with the browsers Google Chrome or Safari.<br>" + "Use this dialog to shut WebAnno down.</HTML>"), JOptionPane.INFORMATION_MESSAGE, JOptionPane.OK_OPTION, null, new String[] { "Shutdown" }); final JDialog dialog = new JDialog((JFrame) null, "WebAnno", true); dialog.setContentPane(optionPane); dialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE); dialog.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent we) { // Avoid closing window by other means than button } }); optionPane.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent aEvt) { if (dialog.isVisible() && (aEvt.getSource() == optionPane) && (aEvt.getPropertyName().equals(JOptionPane.VALUE_PROPERTY))) { System.exit(0); } } }); dialog.pack(); dialog.setVisible(true); } }); } else { log.info("Running in server environment or from command line: disabling interactive shutdown dialog."); } }
From source file:edu.harvard.i2b2.timeline.lifelines.PDOQueryClient.java
public static String sendQueryRequestREST(String XMLstr) { try {//ww w . ja va 2s .c om MessageUtil.getInstance().setRequest("URL: " + getPDOServiceName() + "\n" + XMLstr); OMElement payload = getQueryPayLoad(XMLstr); Options options = new Options(); targetEPR = new EndpointReference(getPDOServiceName()); options.setTo(targetEPR); options.setTransportInProtocol(Constants.TRANSPORT_HTTP); options.setProperty(Constants.Configuration.ENABLE_REST, Constants.VALUE_TRUE); options.setProperty(HTTPConstants.SO_TIMEOUT, new Integer(600000)); options.setProperty(HTTPConstants.CONNECTION_TIMEOUT, new Integer(600000)); ServiceClient sender = new ServiceClient(); sender.setOptions(options); OMElement responseElement = sender.sendReceive(payload); // System.out.println("Client Side response " + // responseElement.toString()); MessageUtil.getInstance() .setResponse("URL: " + getPDOServiceName() + "\n" + responseElement.toString()); return responseElement.toString(); } catch (AxisFault axisFault) { axisFault.printStackTrace(); java.awt.EventQueue.invokeLater(new Runnable() { public void run() { JOptionPane.showMessageDialog(null, "Trouble with connection to the remote server, " + "this is often a network error, please try again", "Network Error", JOptionPane.INFORMATION_MESSAGE); } }); return null; } catch (Exception e) { e.printStackTrace(); return null; } }
From source file:com.haulmont.cuba.desktop.gui.components.DesktopComponentsHelper.java
public static int convertNotificationType(com.haulmont.cuba.gui.components.Frame.NotificationType type) { switch (type) { case WARNING: case WARNING_HTML: return JOptionPane.WARNING_MESSAGE; case ERROR:/* w w w. j a v a 2s .co m*/ case ERROR_HTML: return JOptionPane.ERROR_MESSAGE; case HUMANIZED: case HUMANIZED_HTML: return JOptionPane.INFORMATION_MESSAGE; case TRAY: case TRAY_HTML: return JOptionPane.WARNING_MESSAGE; default: return JOptionPane.PLAIN_MESSAGE; } }
From source file:dialog.DialogFunctionUser.java
private void actionAddUserNoController() { if (!isValidData()) { return;/*w ww .jav a2 s.co m*/ } if (isExistUsername(tfUsername.getText())) { JOptionPane.showMessageDialog(null, "Username tn ti", "Error", JOptionPane.ERROR_MESSAGE); return; } String username = tfUsername.getText(); String fullname = tfFullname.getText(); String password = new String(tfPassword.getPassword()); password = LibraryString.md5(password); int role = cbRole.getSelectedIndex(); User objUser; if (mAvatar != null) { objUser = new User(UUID.randomUUID().toString(), username, password, fullname, role, new Date(System.currentTimeMillis()), mAvatar.getPath()); String fileName = FilenameUtils.getBaseName(mAvatar.getName()) + "-" + System.nanoTime() + "." + FilenameUtils.getExtension(mAvatar.getName()); Path source = Paths.get(mAvatar.toURI()); Path destination = Paths.get("files/" + fileName); try { Files.copy(source, destination, StandardCopyOption.REPLACE_EXISTING); } catch (IOException ex) { Logger.getLogger(DialogFunctionRoom.class.getName()).log(Level.SEVERE, null, ex); } } else { objUser = new User(UUID.randomUUID().toString(), username, password, fullname, role, new Date(System.currentTimeMillis()), ""); } if ((new ModelUser()).addItem(objUser)) { ImageIcon icon = new ImageIcon(getClass().getResource("/images/ic_success.png")); JOptionPane.showMessageDialog(this.getParent(), "Thm thnh cng", "Success", JOptionPane.INFORMATION_MESSAGE, icon); } else { JOptionPane.showMessageDialog(this.getParent(), "Thm tht bi", "Fail", JOptionPane.ERROR_MESSAGE); } this.dispose(); }
From source file:net.sf.jabref.importer.fetcher.DiVAtoBibTeXFetcher.java
@Override public boolean processQuery(String query, ImportInspector inspector, OutputPrinter status) { String q;/*w ww . jav a2s . c om*/ try { q = URLEncoder.encode(query, StandardCharsets.UTF_8.name()); } catch (UnsupportedEncodingException e) { // this should never happen status.setStatus(Localization.lang("Error")); LOGGER.warn("Encoding issues", e); return false; } String urlString = String.format(DiVAtoBibTeXFetcher.URL_PATTERN, q); // Send the request URL url; try { url = new URL(urlString); } catch (MalformedURLException e) { LOGGER.warn("Bad URL", e); return false; } String bibtexString; try { URLDownload dl = new URLDownload(url); bibtexString = dl.downloadToString(StandardCharsets.UTF_8); } catch (FileNotFoundException e) { status.showMessage(Localization.lang("Unknown DiVA entry: '%0'.", query), Localization.lang("Get BibTeX entry from DiVA"), JOptionPane.INFORMATION_MESSAGE); return false; } catch (IOException e) { LOGGER.warn("Communication problems", e); return false; } BibEntry entry = BibtexParser.singleFromString(bibtexString); if (entry != null) { // Optionally add curly brackets around key words to keep the case entry.getFieldOptional(FieldName.TITLE).ifPresent(title -> { // Unit formatting if (Globals.prefs.getBoolean(JabRefPreferences.USE_UNIT_FORMATTER_ON_SEARCH)) { title = unitsToLatexFormatter.format(title); } // Case keeping if (Globals.prefs.getBoolean(JabRefPreferences.USE_CASE_KEEPER_ON_SEARCH)) { title = protectTermsFormatter.format(title); } entry.setField(FieldName.TITLE, title); }); entry.getFieldOptional("institution").ifPresent(institution -> entry.setField("institution", new UnicodeToLatexFormatter().format(institution))); // Do not use the provided key // entry.clearField(InternalBibtexFields.KEY_FIELD); inspector.addEntry(entry); return true; } return false; }
From source file:userInteface.Patient.ManageVitalSignsJPanel.java
private void populateVitalSignTable(Person person) { DefaultTableModel model = (DefaultTableModel) viewVitalSignsJTable.getModel(); model.setRowCount(0);//from w w w . j a va 2 s . c o m if (person != null) { int patientAge = person.getAge(); ArrayList<VitalSign> vitalSignList = person.getPatient().getVitalSignHistory().getHistory(); if (vitalSignList.isEmpty()) { JOptionPane.showMessageDialog(this, "No vital signs found. Please add vital signs", "Error", JOptionPane.INFORMATION_MESSAGE); return; } for (VitalSign vitalSign : vitalSignList) { Object[] row = new Object[2]; row[0] = vitalSign; row[1] = VitalSignStatus(patientAge, vitalSign); model.addRow(row); } } }
From source file:eu.ggnet.dwoss.redtape.action.StateTransitionAction.java
@Override public void actionPerformed(ActionEvent e) { //TODO: All the extra checks for hints don't feel like the optimum //Invoice/* ww w. ja va2s .c om*/ if (((RedTapeStateTransition) transition).getHints() .contains(RedTapeStateTransition.Hint.CREATES_INVOICE)) { int confirmInvoice = JOptionPane.showOptionDialog(parent, "Eine Rechnung wird unwiederruflich erstellt. Mchten Sie fortfahren?", "Rechnungserstellung", JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE, null, null, null); if (confirmInvoice == JOptionPane.CANCEL_OPTION) return; } //Cancel if (((RedTapeStateTransition) transition).equals(RedTapeStateTransitions.CANCEL)) { int confirmInvoice = JOptionPane.showOptionDialog(parent, "Der Vorgang wird storniert.\nMchten Sie fortfahren?", "Abbrechen des Vorganges", JOptionPane.YES_NO_OPTION, JOptionPane.INFORMATION_MESSAGE, null, null, null); if (confirmInvoice == JOptionPane.NO_OPTION) return; } if (((RedTapeStateTransition) transition).getHints() .contains(RedTapeStateTransition.Hint.ADDS_SETTLEMENT)) { SettlementViewCask view = new SettlementViewCask(); OkCancelDialog<SettlementViewCask> dialog = new OkCancelDialog<>(parent, "Zahlung hinterlegen", view); dialog.setVisible(true); if (dialog.getCloseType() == CloseType.OK) { for (Document.Settlement settlement : view.getSettlements()) { cdoc.getDocument().add(settlement); } } else { return; } } if (((RedTapeStateTransition) transition).getHints() .contains(RedTapeStateTransition.Hint.UNIT_LEAVES_STOCK)) { for (Position p : cdoc.getDocument().getPositions(PositionType.PRODUCT_BATCH).values()) { //TODO not the best but fastest solution for now, this must be changed later if (StringUtils.isBlank(p.getRefurbishedId())) { if (JOptionPane.showConfirmDialog(parent, "Der Vorgang enthlt Neuware, wurden alle Seriennummern erfasst?", "Bitte verifizieren", JOptionPane.OK_CANCEL_OPTION) == JOptionPane.CANCEL_OPTION) return; } } } Dossier d = lookup(RedTapeWorker.class).stateChange(cdoc, transition, lookup(Guardian.class).getUsername()) .getDossier(); controller.reloadSelectionOnStateChange(d); }
From source file:net.sf.jabref.gui.worker.VersionWorker.java
@Override public void done() { if (this.isCancelled()) { return;/*from w ww.j a v a 2 s . c o m*/ } try { Version latestVersion = this.get(); if (latestVersion == null) { String couldNotConnect = Localization.lang("Couldn't connect to the update server."); String tryLater = Localization.lang("Please try again later and/or check your network connection."); if (manualExecution) { JOptionPane.showMessageDialog(this.mainFrame, couldNotConnect + "\n" + tryLater, couldNotConnect, JOptionPane.ERROR_MESSAGE); } this.mainFrame.output(couldNotConnect + " " + tryLater); return; } // only respect the ignored version on automated version checks if (latestVersion.equals(toBeIgnored) && !manualExecution) { return; } boolean newer = latestVersion.isNewerThan(installedVersion); if (newer) { new NewVersionDialog(this.mainFrame, installedVersion, latestVersion, toBeIgnored); return; } String upToDate = Localization.lang("JabRef is up-to-date."); if (manualExecution) { JOptionPane.showMessageDialog(this.mainFrame, upToDate, upToDate, JOptionPane.INFORMATION_MESSAGE); } this.mainFrame.output(upToDate); } catch (InterruptedException | ExecutionException e) { LOGGER.error("Error while checking for updates", e); } }
From source file:StocksTable5.java
public void retrieveData() { SimpleDateFormat frm = new SimpleDateFormat("MM/dd/yyyy"); String currentDate = frm.format(m_data.m_date); String result = (String) JOptionPane.showInputDialog(this, "Please enter date in form mm/dd/yyyy:", "Input", JOptionPane.INFORMATION_MESSAGE, null, null, currentDate); if (result == null) return;/*from ww w. j av a2 s . c om*/ java.util.Date date = null; try { date = frm.parse(result); } catch (java.text.ParseException ex) { date = null; } if (date == null) { JOptionPane.showMessageDialog(this, result + " is not a valid date", "Warning", JOptionPane.WARNING_MESSAGE); return; } setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); switch (m_data.retrieveData(date)) { case 0: // Ok with data m_title.setText(m_data.getTitle()); m_table.tableChanged(new TableModelEvent(m_data)); m_table.repaint(); break; case 1: // No data JOptionPane.showMessageDialog(this, "No data found for " + result, "Warning", JOptionPane.WARNING_MESSAGE); break; case -1: // Error JOptionPane.showMessageDialog(this, "Error retrieving data", "Warning", JOptionPane.WARNING_MESSAGE); break; } setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); }
From source file:net.itransformers.topologyviewer.menu.handlers.graphTools.shortherstPathMenuHandlers.DijkstraWeightedShortestPathMenuHandler.java
@Override public void actionPerformed(ActionEvent e) { final GraphViewerPanel viewerPanel = (GraphViewerPanel) frame.getTabbedPane().getSelectedComponent(); final MyVisualizationViewer vv = (MyVisualizationViewer) viewerPanel.getVisualizationViewer(); Collection<String> vertices = viewerPanel.getCurrentGraph().getVertices(); String[] test = vertices.toArray(new String[0]); Arrays.sort(test);/*from w w w .jav a 2s . com*/ final String mFrom = (String) JOptionPane.showInputDialog(frame, "Choose A Node", "A Node", JOptionPane.PLAIN_MESSAGE, null, test, test[0]); final String mTo = (String) JOptionPane.showInputDialog(frame, "Choose B Node", "B Node", JOptionPane.PLAIN_MESSAGE, null, test, test[0]); String weightedKey = JOptionPane.showInputDialog(frame, "Enter Weighted Key", "Weighted Key", JOptionPane.QUESTION_MESSAGE); Transformer<String, Double> wtTransformer = new Transformer<String, Double>() { public Double transform(String edgeId) { return null; } }; final Graph<String, String> mGraph = viewerPanel.getCurrentGraph(); DijkstraShortestPath<String, String> alg = new DijkstraShortestPath(mGraph, wtTransformer); final List<String> mPred = alg.getPath(mFrom, mTo); // System.out.println("The shortest unweighted path from" + mFrom +" to " + mTo + " is:"); // System.out.println(mPred.toString()); if (mPred == null) { JOptionPane.showMessageDialog(frame, String.format("Shortest path between %s,%s is not found", mFrom, mTo), "Message", JOptionPane.INFORMATION_MESSAGE); return; } final Layout<String, String> layout = vv.getGraphLayout(); for (final String edge : layout.getGraph().getEdges()) { if (mPred.contains(edge)) { vv.setEdgeStroke(edge, new BasicStroke(4f)); } } }