List of usage examples for javax.swing JOptionPane WARNING_MESSAGE
int WARNING_MESSAGE
To view the source code for javax.swing JOptionPane WARNING_MESSAGE.
Click Source Link
From source file:com.tiempometa.muestradatos.JMuestraDatos.java
private void usbConnectButtonActionPerformed(ActionEvent e) { if (ReaderContext.isUsbConnected()) { if (ReaderContext.isUsbReading()) { JOptionPane.showMessageDialog(this, "Debes detener todas las lecturas antes de desconectar el lector", "Lectura activa", JOptionPane.WARNING_MESSAGE); } else {/*w ww .j a va2s .c om*/ try { ReaderContext.disconnectUsbReader(); JOptionPane.showMessageDialog(this, "Se desconect con xito del lector usb", "Desconexin exitosa", JOptionPane.INFORMATION_MESSAGE); usbConnectButton.setText("Conectar"); } catch (ReaderException e1) { JOptionPane.showMessageDialog(this, "Error de desconexin: " + e1.getMessage(), "Error USB", JOptionPane.ERROR_MESSAGE); } } } else { try { ReaderContext.connectUsbReader(ReaderContext.getSettings().getUsbPort()); JOptionPane.showMessageDialog(this, "Se conect con xito al lector usb", "Conexin exitosa", JOptionPane.INFORMATION_MESSAGE); usbConnectButton.setText("Desonectar"); } catch (ReaderException e1) { JOptionPane.showMessageDialog(this, "Error de conexin: " + e1.getMessage(), "Error USB", JOptionPane.ERROR_MESSAGE); } } }
From source file:io.github.jeddict.jpa.modeler.properties.implement.JavaClassArtifactPanel.java
private boolean validateField() { String _class = this.class_EditorPane.getText().trim(); int genericIndex = _class.indexOf('<');//generic type if (_class .length() <= 0 /*|| Pattern.compile("[^\\w-]").matcher(this.id_TextField.getText().trim()).find()*/) { JOptionPane.showMessageDialog(this, String.format("%s can't be empty", artifactType), "Invalid Value", javax.swing.JOptionPane.WARNING_MESSAGE); return false; } else if (genericIndex > 1 ? !JavaIdentifiers.isValidPackageName(_class.substring(0, genericIndex)) : !JavaIdentifiers.isValidPackageName(_class)) { JOptionPane.showMessageDialog(this, String.format("Invalid %s type", artifactType), "Invalid Value", javax.swing.JOptionPane.WARNING_MESSAGE); return false; }/*from w w w . j a va2s .c om*/ return true; }
From source file:com.haulmont.cuba.desktop.App.java
protected void exit() { try {//from w ww .j a v a2 s. c o m userActionsLog.trace("Closing application..."); if (connection.isConnected()) { recursiveClosingFrames(topLevelFrames.iterator(), () -> { exiting = true; connection.logout(); forceExit(); }); } else { forceExit(); } } catch (Throwable e) { log.warn("Error closing application", e); String title = messages.getMainMessage("errorPane.title"); String text = messages.getMainMessage("unexpectedCloseException.message") + "\n"; if (e instanceof RemoteAccessException) { text = text + messages.getMainMessage("connectException.message"); } else { text = text + e.getClass().getSimpleName() + ": " + e.getMessage(); } JOptionPane.showMessageDialog(mainFrame, text, title, JOptionPane.WARNING_MESSAGE); forceExit(); } }
From source file:be.ugent.maf.cellmissy.gui.controller.analysis.doseresponse.generic.GenericDRResultsController.java
@Override public File createAnalysisReport(File directory, String reportName) { File pdfFile = new File(directory, reportName); if (reportName.endsWith(".pdf")) { tryToCreateFile(pdfFile);/*w w w.j av a2s.c o m*/ } else { doseResponseController.showMessage("Please use .pdf extension for the file.", "extension file problem", JOptionPane.WARNING_MESSAGE); // retry to create pdf file try { doseResponseController.createPdfReport(); } catch (IOException ex) { LOG.error(ex.getMessage(), ex); doseResponseController.showMessage("An error occurred: " + ex.getMessage(), "unexpected error", JOptionPane.ERROR_MESSAGE); } } return pdfFile; }
From source file:io.github.jeddict.jpa.modeler.properties.custom.snippet.CustomSnippetPanel.java
private boolean validateField() { if (this.customCodeEditorPane.getText().trim() .length() <= 0 /*|| Pattern.compile("[^\\w-]").matcher(this.id_TextField.getText().trim()).find()*/) { JOptionPane.showMessageDialog(this, "Snippet can't be empty", "Invalid Value", javax.swing.JOptionPane.WARNING_MESSAGE); return false; }/*from w w w . j a v a 2s . c om*/ return true; }
From source file:fr.eurecom.hybris.demogui.HybrisDemoGui.java
public void keyReleased(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_DELETE) { JList<String> jlist = (JList<String>) e.getComponent(); if (jlist.getSelectedIndex() >= 0) { if (jlist.equals(lstAmazon)) { new Thread(cm.new BackgroundWorker(OperationType.DELETE, ClientType.AWS, jlist.getSelectedValue(), null)).start(); System.out.println("Removed " + jlist.getSelectedValue() + " from Amazon S3."); corruptedItems.remove("amazon" + jlist.getSelectedValue()); } else if (jlist.equals(lstAzure)) { new Thread(cm.new BackgroundWorker(OperationType.DELETE, ClientType.AZURE, jlist.getSelectedValue(), null)).start(); System.out.println("Removed " + jlist.getSelectedValue() + " from Azure."); corruptedItems.remove("azure" + jlist.getSelectedValue()); } else if (jlist.equals(lstGoogle)) { new Thread(cm.new BackgroundWorker(OperationType.DELETE, ClientType.GOOGLE, jlist.getSelectedValue(), null)).start(); System.out.println("Removed " + jlist.getSelectedValue() + " from Google."); corruptedItems.remove("google" + jlist.getSelectedValue()); } else if (jlist.equals(lstRackspace)) { new Thread(cm.new BackgroundWorker(OperationType.DELETE, ClientType.RACKSPACE, jlist.getSelectedValue(), null)).start(); System.out.println("Removed " + jlist.getSelectedValue() + " from Rackspace."); corruptedItems.remove("rackspace" + jlist.getSelectedValue()); } else if (jlist.equals(lstHybris)) { new Thread(cm.new BackgroundWorker(OperationType.DELETE, ClientType.HYBRIS, jlist.getSelectedValue(), null)).start(); System.out.println("Removed " + jlist.getSelectedValue() + " from Hybris."); }//from w ww. j a v a2 s .c o m } } else if (e.getKeyChar() == 'c') { JList<String> jlist = (JList<String>) e.getComponent(); if (jlist.getSelectedIndex() >= 0) { byte[] corruptedPayload = "I_AM_THE_BOGUS_PAYLOAD".getBytes(); if (jlist.equals(lstAmazon)) { JOptionPane.showMessageDialog(frame, "Corrupted " + jlist.getSelectedValue() + " on Amazon S3.", "Corruption", JOptionPane.WARNING_MESSAGE); System.out.println("Corrupted " + jlist.getSelectedValue() + " on Amazon S3."); corruptedItems.add("amazon" + jlist.getSelectedValue()); new Thread(cm.new BackgroundWorker(OperationType.PUT, ClientType.AWS, jlist.getSelectedValue(), corruptedPayload)).start(); } else if (jlist.equals(lstAzure)) { System.out.println("Corrupted " + jlist.getSelectedValue() + " on Azure."); JOptionPane.showMessageDialog(frame, "Corrupted " + jlist.getSelectedValue() + " on Azure.", "Corruption", JOptionPane.WARNING_MESSAGE); corruptedItems.add("azure" + jlist.getSelectedValue()); new Thread(cm.new BackgroundWorker(OperationType.PUT, ClientType.AZURE, jlist.getSelectedValue(), corruptedPayload)).start(); } else if (jlist.equals(lstGoogle)) { JOptionPane.showMessageDialog(frame, "Corrupted " + jlist.getSelectedValue() + " on Google.", "Corruption", JOptionPane.WARNING_MESSAGE); System.out.println("Corrupted " + jlist.getSelectedValue() + " on Google."); corruptedItems.add("google" + jlist.getSelectedValue()); new Thread(cm.new BackgroundWorker(OperationType.PUT, ClientType.GOOGLE, jlist.getSelectedValue(), corruptedPayload)).start(); } else if (jlist.equals(lstRackspace)) { JOptionPane.showMessageDialog(frame, "Corrupted " + jlist.getSelectedValue() + " on Rackspace.", "Corruption", JOptionPane.WARNING_MESSAGE); System.out.println("Corrupted " + jlist.getSelectedValue() + " on Rackspace."); corruptedItems.add("rackspace" + jlist.getSelectedValue()); new Thread(cm.new BackgroundWorker(OperationType.PUT, ClientType.RACKSPACE, jlist.getSelectedValue(), corruptedPayload)).start(); } } } }
From source file:com.sec.ose.osi.ui.frm.main.JMenuMain.java
public JMenuItem getJMenuItemSyncFromServer() { if (jMenuItemSyncFromServer == null) { jMenuItemSyncFromServer = new JMenuItem(); jMenuItemSyncFromServer.setText("Sync from Server"); jMenuItemSyncFromServer.setEnabled(false); jMenuItemSyncFromServer.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { log.debug("Sync from Server clicked"); String projectName = IdentifyMediator.getInstance().getSelectedProjectName(); if (IdentifyQueue.getInstance().isIdentifyCompleted(projectName) == false) { log.debug("Identification for \"" + projectName + "\" is not completed yet."); String message = "Identification for \"" + projectName + "\" is not completed yet.\n" + "You should click \"sync to server\" before \"sync from server\" in this case."; JOptionPane.showMessageDialog(null, message, "Identification is not completed", JOptionPane.WARNING_MESSAGE); return; }/*from ww w . j a v a 2 s . c o m*/ mEventHandler.handle(EventHandler.MAN_TOOL_SYNC_FROM_SERVER); } }); } return jMenuItemSyncFromServer; }
From source file:com.jtk.pengelolaanujian.view.dosenpengampu.UploadSoal.java
private void btnUploadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnUploadActionPerformed if (textUrl.getText().isEmpty()) { JOptionPane.showMessageDialog(null, "Harap pilih file yang akan di upload", "Perhatian", JOptionPane.WARNING_MESSAGE); } else if (!new File(url).exists()) { JOptionPane.showMessageDialog(null, "File yang anda upload tidak ada", "Perhatian", JOptionPane.WARNING_MESSAGE); } else if (spinDurasi.getValue() == null) { JOptionPane.showMessageDialog(null, "Harap isi durasi ujian", "Perhatian", JOptionPane.WARNING_MESSAGE); } else if (!CommonHelper.isStringNumberMaxMin(spinDurasi.getValue().toString(), 1000, 1)) { JOptionPane.showMessageDialog(null, "Harap isi format durasi dengan benar", "Perhatian", JOptionPane.WARNING_MESSAGE); } else {//from w w w.j a v a2s . c om try { InputStream is = new FileInputStream(new File(url)); int durasi = Integer.parseInt(spinDurasi.getValue().toString()); String tipeFile = FilenameUtils.getExtension(url); String namaFile = FilenameUtils.getBaseName(url); if (uploadSoalController.uploadSoal(is, ujianList.get(cboMatkul.getSelectedIndex()).getUjianKode(), soal.getSoalSifat(), durasi, tipeFile, namaFile)) { JOptionPane.showMessageDialog(null, "File berhasil di upload", "Perhatian", JOptionPane.INFORMATION_MESSAGE); Reminder3Controller reminder3Controller = new Reminder3Controller(); reminder3Controller.preparation(); clear(); } } catch (FileNotFoundException ex) { Logger.getLogger(UploadSoal.class.getName()).log(Level.SEVERE, null, ex); } } }
From source file:sanger.team16.gui.genevar.eqtl.snp.CisEQTLSNPPane.java
private void cisSNPPaneActionPerformed(ActionEvent ae) { int studyIndex = cbStudy.getSelectedIndex(); int statisticIndex = cbStatistic.getSelectedIndex(); //SelectedIndex selectedIndex = new SelectedIndex(studyIndex, this.getStudyReferenceIndex(studyIndex), statisticIndex, taSNP.getText()); //CHANGE 07/12/11 dun know? only do it if ae.getSource() == cbStudy //int referenceIndex = cbReference.getSelectedIndex(); //TODO merge into SelectedIndex //int referenceId = ((Reference) cbReference.getSelectedItem()).getId(); //TODO if (ae.getSource() == cbStudy) { if (studyIndex == 0) this.refresh(new SelectedIndex()); else { //TODO //List<MatchedFeature> matchedFeatures = this.getMatchedFeatures(study.getId()); //this.matchedFeatureTable = new MatchedFeatureTableModel(matchedFeatures).getTable(); statisticIndex = 0; //ADD 02/12/10 this.refresh(new SelectedIndex(studyIndex, this.getStudyReferenceIndex(studyIndex), statisticIndex, taSNP.getText()));/* w w w .j a v a 2 s . c om*/ this.setSubmitButton(); } isDefault = true; //ADD 02/12/10 } else if (ae.getSource() == cbReference) { this.setSubmitButton(); // ADD 18/06/10 } else if (ae.getSource() == cbStatistic) { this.refresh(new SelectedIndex(studyIndex, this.getStudyReferenceIndex(studyIndex), statisticIndex, taSNP.getText())); this.setSubmitButton(); } else if (ae.getSource() == bReset) { this.refresh(new SelectedIndex()); } else if (ae.getSource() == bSNPFile) { this.ui.addChoosableFileFilter(Message.TXT); if (this.ui.showFileChooserOpenDialog(this.ui, null)) tfSNPFile.setText(this.ui.getFileChooserSelectedFile().getAbsolutePath()); } else if (ae.getSource() == bSubmit) { int distance = new Integer(((String) cbDistance.getSelectedItem()).replaceAll(",", "")); if (distance > 1000000) JOptionPane.showMessageDialog(ui, "No greater than 1 Mb", "Distance to SNP", JOptionPane.WARNING_MESSAGE); else new CisSNPPaneProgressBar().execute(); //bSubmit.setEnabled(false); } }
From source file:dbseer.gui.panel.DBSeerSelectableChartPanel.java
@Override public void chartMouseClicked(ChartMouseEvent chartMouseEvent) { ChartEntity entity = chartMouseEvent.getEntity(); MouseEvent mouseEvent = chartMouseEvent.getTrigger(); if (SwingUtilities.isLeftMouseButton(mouseEvent) && entity != null && entity instanceof PieSectionEntity) { java.util.List<String> names = dataset.getTransactionTypeNames(); PieSectionEntity pieSectionEntity = (PieSectionEntity) entity; int idx = pieSectionEntity.getSectionIndex(); String name = (String) JOptionPane.showInputDialog(null, "Enter the name for this transaction type", "Transaction Type", JOptionPane.PLAIN_MESSAGE, null, null, ""); if (name != null) { if (names.contains(name) && !names.get(idx).equals(name) && !name.isEmpty()) { JOptionPane.showMessageDialog(null, "Please enter a different name for the transaction type.\nEach name has to be unique.", "Warning", JOptionPane.WARNING_MESSAGE); } else { PieDataset oldDataset = pieSectionEntity.getDataset(); DefaultPieDataset newDataset = new DefaultPieDataset(); PiePlot plot = (PiePlot) chart.getPlot(); String oldName = (String) oldDataset.getKey(idx); names.set(idx, name);// ww w .j a v a 2s . c o m dataset.setTransactionTypeName(idx, name); for (int i = 0; i < oldDataset.getItemCount(); ++i) { String key = (String) oldDataset.getKey(i); Number number = oldDataset.getValue(i); if (key.equals(oldName)) { if (name.isEmpty()) newDataset.setValue("Transaction Type " + (i + 1), number); else newDataset.setValue(name, number); } else { newDataset.setValue(key, number); } } Paint[] tempPaint = new Paint[oldDataset.getItemCount()]; for (int i = 0; i < oldDataset.getItemCount(); ++i) { String key = (String) oldDataset.getKey(i); tempPaint[i] = plot.getSectionPaint(key); } ((DefaultPieDataset) oldDataset).clear(); plot.setDataset(newDataset); for (int i = 0; i < newDataset.getItemCount(); ++i) { String key = (String) newDataset.getKey(i); plot.setSectionPaint(key, tempPaint[i]); } } } } }