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:be.ugent.maf.cellmissy.gui.controller.analysis.doseresponse.generic.GenericDRResultsController.java
@Override protected void tryToCreateFile(File pdfFile) { try {//from w ww. j a va2 s .c om boolean success = pdfFile.createNewFile(); if (success) { doseResponseController.showMessage("Pdf Report successfully created!", "Report created", JOptionPane.INFORMATION_MESSAGE); } else { Object[] options = { "Yes", "No", "Cancel" }; int showOptionDialog = JOptionPane.showOptionDialog(null, "File already exists. Do you want to replace it?", "", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[2]); // if YES, user wants to delete existing file and replace it if (showOptionDialog == 0) { boolean delete = pdfFile.delete(); if (!delete) { return; } // if NO, returns already existing file } else if (showOptionDialog == 1) { return; } } } catch (IOException ex) { doseResponseController.showMessage("Unexpected error: " + ex.getMessage() + ".", "Unexpected error", JOptionPane.ERROR_MESSAGE); return; } try (FileOutputStream fileOutputStream = new FileOutputStream(pdfFile)) { // actually create PDF file createPdfFile(fileOutputStream); } catch (IOException ex) { doseResponseController.showMessage("Unexpected error: " + ex.getMessage() + ".", "Unexpected error", JOptionPane.ERROR_MESSAGE); } }
From source file:eu.ggnet.dwoss.redtape.position.PositionUpdateCask.java
@Override public boolean onOk() { if (StringUtils.isBlank(description)) { Alert.show(this, "Beschreibung darf nich leer sein."); return false; }// w w w . j a va 2 s . c om if (StringUtils.isBlank(positionName)) { Alert.show(this, "Name darf nich leer sein."); return false; } position.setDescription(description); position.setName(positionName); position.setAmount(amount); position.setTax(GlobalConfig.TAX); position.setBookingAccount(bookingAccount); try { position.setPrice(Double.valueOf(priceField.getText().replace(",", "."))); position.setAfterTaxPrice(Double.valueOf(afterTaxPriceField.getText().replace(",", "."))); } catch (NumberFormatException e) { Alert.show(this, "Preisformat ist nicht lesbar"); } for (Binding binding : bindingGroup.getBindings()) { binding.save(); } if (position.getPrice() == 0 && position.getType() != PositionType.COMMENT) { // TODO: We need something like Alert. e.g. Question.ask return JOptionPane.showConfirmDialog(this, "Preis ist 0, trotzdem fortfahren?", "Position bearbeiten", JOptionPane.YES_NO_OPTION, JOptionPane.INFORMATION_MESSAGE) == 0; } for (Component component : this.getComponents()) { accessCos.remove(component); } return true; }
From source file:Logi.GSeries.Service.LogiGSKService.java
public void showSystemTray() { if ((systemTray != null) && !systemTrayVisible) { systemTray.setEnabled(true);//ww w .ja va 2 s. com systemTrayVisible = true; return; } try { systemTray = SystemTray.getNative(); } catch (Exception ex) { System.out.println(ex.getMessage()); Logger.getLogger(LogiGSKService.class.getName()).log(Level.SEVERE, null, ex); } if (systemTray != null) { try { systemTray.setImage(GSK_Icon); } catch (Exception e) { System.err.println("Problem setting system tray icon."); } systemTrayVisible = true; callbackOpen = new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { final MenuItem entry = (MenuItem) e.getSource(); try { CommandLine commandLine = new CommandLine("java"); commandLine.addArgument("-jar"); String jarPath = new URI( LogiGSKService.class.getProtectionDomain().getCodeSource().getLocation().getPath()) .getPath(); commandLine.addArgument(jarPath, false); DefaultExecutor executor = new DefaultExecutor(); executor.setExitValue(1); executor.execute(commandLine, new DefaultExecuteResultHandler()); } catch (URISyntaxException ex) { Logger.getLogger(LogiGSKService.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(LogiGSKService.class.getName()).log(Level.SEVERE, null, ex); } } }; callbackAbout = new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { final MenuItem entry = (MenuItem) e.getSource(); JOptionPane.showMessageDialog(null, "<HTML>LogiGSK V1.0</HTML>", "LogiGSK", JOptionPane.INFORMATION_MESSAGE); } }; Menu mainMenu = systemTray.getMenu(); MenuItem openEntry = new MenuItem("Open", new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { final MenuItem entry = (MenuItem) e.getSource(); entry.setCallback(callbackOpen); try { CommandLine commandLine = new CommandLine("java"); commandLine.addArgument("-jar"); String jarPath = new URI( LogiGSKService.class.getProtectionDomain().getCodeSource().getLocation().getPath()) .getPath(); commandLine.addArgument(jarPath, false); DefaultExecutor executor = new DefaultExecutor(); executor.setExitValue(1); executor.execute(commandLine, new DefaultExecuteResultHandler()); } catch (URISyntaxException ex) { Logger.getLogger(LogiGSKService.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(LogiGSKService.class.getName()).log(Level.SEVERE, null, ex); } } }); openEntry.setShortcut('O'); mainMenu.add(openEntry); mainMenu.add(new Separator()); MenuItem aboutEntry = new MenuItem("About", new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { final MenuItem entry = (MenuItem) e.getSource(); JOptionPane.showMessageDialog(null, "<HTML>LogiGSK V1.0</HTML>", "LogiGSK", JOptionPane.INFORMATION_MESSAGE); entry.setCallback(callbackAbout); } }); openEntry.setShortcut('A'); mainMenu.add(aboutEntry); /*} else { System.err.println("System tray is null!"); }*/ } }
From source file:net.dv8tion.jda.core.utils.SimpleLog.java
/** * prints a message to the console or as message-box. * * @param msg the message, that should be displayed * @param level the LOG level of the message *///w w w .ja v a 2 s. co m private void print(String msg, Level level) { if (ENABLE_GUI && !isConsolePresent()) { if (level.isError()) { JOptionPane.showMessageDialog(null, msg, "An Error occurred!", JOptionPane.ERROR_MESSAGE); } else { JOptionPane.showMessageDialog(null, msg, level.getTag(), JOptionPane.INFORMATION_MESSAGE); } } else { if (level.isError()) { System.err.println(msg); } else { System.out.println(msg); } } }
From source file:lab4.YouQuiz.java
private void updateAnswerForm() { contentPanel.answerPanel.removeAll(); final Question question = questionsArray.get(questionIndex); switch (question.type) { case Question.QUESTION_TYPE_MULTIPLE_CHOICE: case Question.QUESTION_TYPE_TRUE_FALSE: JRadioButton radioButton; final ButtonGroup radioGroup = new ButtonGroup(); for (int i = 0; i < ((MultipleChoiceQuestion) question).getChoices().size(); ++i) { radioButton = new JRadioButton(((MultipleChoiceQuestion) question).getChoices().get(i)); radioButton.setFont(new Font("Consolas", Font.PLAIN, 20)); radioGroup.add(radioButton); radioButton.setFocusable(false); contentPanel.answerPanel.add(radioButton); }//www . j a v a 2s . com for (ActionListener al : contentPanel.checkButton.getActionListeners()) { contentPanel.checkButton.removeActionListener(al); } contentPanel.checkButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { if (question.checkAnswer(getSelectedButtonText(radioGroup))) { JOptionPane.showMessageDialog(null, "Thats Great, Correct Answer", "Excellent", JOptionPane.INFORMATION_MESSAGE); } else { JOptionPane.showMessageDialog(null, "Oops! Wrong Answer. Its '" + question.getAnswer().get(0) + "'", "Sorry", JOptionPane.ERROR_MESSAGE); } } }); break; case Question.QUESTION_TYPE_SHORT_ANSWER: final JTextField answerText = new JTextField(25); answerText.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 20)); contentPanel.answerPanel.add(answerText); for (ActionListener al : contentPanel.checkButton.getActionListeners()) { contentPanel.checkButton.removeActionListener(al); } contentPanel.checkButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { if (question.checkAnswer(answerText.getText())) { JOptionPane.showMessageDialog(null, "Thats Great, Correct Answer", "Excellent", JOptionPane.INFORMATION_MESSAGE); } else { JOptionPane.showMessageDialog(null, "Oops! Wrong Answer. Its '" + question.getAnswer().get(0) + "'", "Sorry", JOptionPane.ERROR_MESSAGE); } } }); break; } contentPanel.answerPanel.invalidate(); }
From source file:com.iucosoft.eavertizare.gui.FirmaJDialog.java
private void jButtonSaveFirmaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonSaveFirmaActionPerformed getDataFirma();//w ww.j av a 2 s.c om String word = ""; if (firma.getId() < 1) { //save int idConfiguratie = firmaDao.getMaxId("configuratii_db"); configuratii = configuratiiDao.findById(idConfiguratie); firma.setConfiguratii(configuratii); firmaDao.save(firma); updateDate(); word = "adaugata"; } else {// update firmaDao.update(firma); word = "editata"; } JOptionPane.showMessageDialog(this, "Firma " + word + " cu success", "Info", JOptionPane.INFORMATION_MESSAGE); parent.refreshFrame(); if (firmaTableModel != null) { firmaTableModel.refreshModel(); } this.dispose(); }
From source file:components.DialogDemo.java
private JPanel createIconDialogBox() { JButton showItButton = null;/*from w w w . j av a 2 s.com*/ final int numButtons = 6; JRadioButton[] radioButtons = new JRadioButton[numButtons]; final ButtonGroup group = new ButtonGroup(); final String plainCommand = "plain"; final String infoCommand = "info"; final String questionCommand = "question"; final String errorCommand = "error"; final String warningCommand = "warning"; final String customCommand = "custom"; radioButtons[0] = new JRadioButton("Plain (no icon)"); radioButtons[0].setActionCommand(plainCommand); radioButtons[1] = new JRadioButton("Information icon"); radioButtons[1].setActionCommand(infoCommand); radioButtons[2] = new JRadioButton("Question icon"); radioButtons[2].setActionCommand(questionCommand); radioButtons[3] = new JRadioButton("Error icon"); radioButtons[3].setActionCommand(errorCommand); radioButtons[4] = new JRadioButton("Warning icon"); radioButtons[4].setActionCommand(warningCommand); radioButtons[5] = new JRadioButton("Custom icon"); radioButtons[5].setActionCommand(customCommand); 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(); //no icon if (command == plainCommand) { JOptionPane.showMessageDialog(frame, "Eggs aren't supposed to be green.", "A plain message", JOptionPane.PLAIN_MESSAGE); //information icon } else if (command == infoCommand) { JOptionPane.showMessageDialog(frame, "Eggs aren't supposed to be green.", "Inane informational dialog", JOptionPane.INFORMATION_MESSAGE); //XXX: It doesn't make sense to make a question with //XXX: only one button. //XXX: See "Yes/No (but not in those words)" for a better solution. //question icon } else if (command == questionCommand) { JOptionPane.showMessageDialog(frame, "You shouldn't use a message dialog " + "(like this)\n" + "for a question, OK?", "Inane question", JOptionPane.QUESTION_MESSAGE); //error icon } else if (command == errorCommand) { JOptionPane.showMessageDialog(frame, "Eggs aren't supposed to be green.", "Inane error", JOptionPane.ERROR_MESSAGE); //warning icon } else if (command == warningCommand) { JOptionPane.showMessageDialog(frame, "Eggs aren't supposed to be green.", "Inane warning", JOptionPane.WARNING_MESSAGE); //custom icon } else if (command == customCommand) { JOptionPane.showMessageDialog(frame, "Eggs aren't supposed to be green.", "Inane custom dialog", JOptionPane.INFORMATION_MESSAGE, icon); } } }); return create2ColPane(iconDesc + ":", radioButtons, showItButton); }
From source file:at.tuwien.ifs.feature.evaluation.SimilarityRetrievalGUI.java
private void initButtonSaveResults() { btnSaveResults = new JButton("Save as ..."); btnSaveResults.setEnabled(false); // can't save right away, need a first search btnSaveResults.addActionListener(new ActionListener() { @Override/*from ww w.ja v a2 s . co m*/ public void actionPerformed(ActionEvent e) { fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); if (fileChooser.getSelectedFile() != null) { // reusing the dialog fileChooser.setSelectedFile(null); } int returnVal = fileChooser.showDialog(SimilarityRetrievalGUI.this, "Save results to file ..."); if (returnVal == JFileChooser.APPROVE_OPTION) { try { PrintWriter w = FileUtils.openFileForWriting("Results file", fileChooser.getSelectedFile().getAbsolutePath()); TableModel model = resultsTable.getModel(); // column headers for (int col = 0; col < model.getColumnCount(); col++) { w.print(model.getColumnName(col) + "\t"); } w.println(); // write each data row for (int row = 0; row < model.getRowCount(); row++) { for (int col = 0; col < model.getColumnCount(); col++) { w.print(model.getValueAt(row, col) + "\t"); } w.println(); } w.flush(); w.close(); JOptionPane.showMessageDialog(SimilarityRetrievalGUI.this, "Successfully wrote to file " + fileChooser.getSelectedFile().getAbsolutePath(), "Results stored", JOptionPane.INFORMATION_MESSAGE); } catch (IOException e1) { e1.printStackTrace(); } } } }); }
From source file:javaresturentdesktopclient.BillingPage.java
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed // TODO add your handling code here: ServletRequest.setServletRequest(Constant.BILLING_SERVLET); DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); //get current date time with Date() Date date = new Date(); String DateTime = dateFormat.format(date); Date = DateTime.substring(0, 10); Time = DateTime.substring(11, 18); System.out.println("Date: " + Date + " Time: " + Time); //send request to servlet List<NameValuePair> paramLis = new ArrayList<>(); paramLis.add(new BasicNameValuePair(Constant.KEY_COMMAND, Constant.KEY_TOTAL_BILLING)); paramLis.add(new BasicNameValuePair(Constant.KEY_DATE, Date.trim())); paramLis.add(new BasicNameValuePair(Constant.KEY_TIME, Time.trim())); paramLis.add(new BasicNameValuePair(Constant.KEY_TRANSACTIONID, transactionId.toString())); String response = HttpClientUtil.postRequest(paramLis); //get response if (response.equalsIgnoreCase("failure")) { JOptionPane.showMessageDialog(null, "Failed!", "Error Message", JOptionPane.ERROR_MESSAGE); } else {// w ww .j ava 2s. c o m JOptionPane.showMessageDialog(null, "Total " + response, "Information", JOptionPane.INFORMATION_MESSAGE); Total = response; System.out.println("total " + response); jTextField3.setText(null); jTextField4.setText(null); count = 1; MealNo = 1; } }
From source file:EscribirCorreo.java
private void SubirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SubirActionPerformed //Codigo para subir archivo String localfile = subir1Field.getText(); String server = "51.254.137.26"; String username = "proyecto"; String password = "proyecto"; String destinationfile = nombre; try {/*from w w w .j av a2s. c o m*/ FTPClient ftp = new FTPClient(); ftp.connect(server); if (!ftp.login(username, password)) { ftp.logout(); } int reply = ftp.getReplyCode(); if (!FTPReply.isPositiveCompletion(reply)) { ftp.disconnect(); } InputStream in = new FileInputStream(localfile); ftp.setFileType(ftp.BINARY_FILE_TYPE); ftp.storeFile(destinationfile, in); JOptionPane.showMessageDialog(null, "Archivo subido correctamente", "Subido!", JOptionPane.INFORMATION_MESSAGE); if (archivos == null) { archivos = "http://51.254.137.26/proyecto/" + destinationfile; } else { archivos = archivos + "#http://51.254.137.26/proyecto/" + destinationfile; } in.close(); ftp.logout(); ftp.disconnect(); } catch (Exception ex) { ex.printStackTrace(); } }