List of usage examples for javax.swing JOptionPane ERROR_MESSAGE
int ERROR_MESSAGE
To view the source code for javax.swing JOptionPane ERROR_MESSAGE.
Click Source Link
From source file:be.ac.ua.comp.scarletnebula.gui.addserverwizard.ChooseImagePage.java
@Override public WizardPage next(final DataRecorder recorder) { final AddServerWizardDataRecorder rec = (AddServerWizardDataRecorder) recorder; if (tabs.getSelectedComponent() == allImagesPanel) { final int selection = allImagesTable.getSelectedRow(); if (selection < 0) { JOptionPane.showMessageDialog(this, "Select an image by choosing a platform, architecture, " + "entering search terms in the search box and subsequently pressing the ENTER button.", "Select image", JOptionPane.ERROR_MESSAGE); return null; }//from w w w .j a va2 s . co m rec.image = allImagesModel.getRow(allImagesTable.convertRowIndexToModel(selection)); } else { final MachineImage selection = favoriteImagesPanel.getSelection(); if (selection == null) { JOptionPane.showMessageDialog(this, "Either select one of your favorite images or go to the All Images tab and search for an image.", "Select image", JOptionPane.ERROR_MESSAGE); return null; } rec.image = selection; } return new ChooseSizePage(provider, rec.image); }
From source file:net.sf.jabref.sql.importer.DbImportAction.java
private void performImport() { if (!connectedToDB) { return;//from w w w. j a v a2 s.c om } frame.output(Localization.lang("Attempting SQL import...")); DBExporterAndImporterFactory factory = new DBExporterAndImporterFactory(); DatabaseImporter importer = factory.getImporter(dbs.getDbPreferences().getServerType()); try { try (Connection conn = importer.connectToDB(dbs); Statement statement = conn.createStatement(); ResultSet rs = statement.executeQuery(SQLUtil.queryAllFromTable("jabref_database"))) { Vector<Vector<String>> matrix = new Vector<>(); while (rs.next()) { Vector<String> v = new Vector<>(); v.add(rs.getString("database_name")); matrix.add(v); } if (matrix.isEmpty()) { JOptionPane.showMessageDialog(frame, Localization.lang("There are no available databases to be imported"), Localization.lang("Import from SQL database"), JOptionPane.INFORMATION_MESSAGE); } else { DBImportExportDialog dialogo = new DBImportExportDialog(frame, matrix, DBImportExportDialog.DialogType.IMPORTER); if (dialogo.removeAction) { String dbName = dialogo.selectedDB; DatabaseUtil.removeDB(dialogo, dbName, conn, databaseContext); performImport(); } else if (dialogo.moreThanOne) { // use default DB mode for import databases = importer.performImport(dbs, dialogo.listOfDBs, Globals.prefs.getDefaultBibDatabaseMode()); for (DBImporterResult res : databases) { databaseContext = res.getDatabaseContext(); dbs.isConfigValid(true); } frame.output(Localization.lang("%0 databases will be imported", Integer.toString(databases.size()))); } else { frame.output(Localization.lang("Importing canceled")); } } } } catch (Exception ex) { String preamble = Localization.lang("Could not import from SQL database for the following reason:"); String errorMessage = SQLUtil.getExceptionMessage(ex); dbs.isConfigValid(false); JOptionPane.showMessageDialog(frame, preamble + '\n' + errorMessage, Localization.lang("Import from SQL database"), JOptionPane.ERROR_MESSAGE); frame.output(Localization.lang("Error importing from database")); LOGGER.error("Error importing from database", ex); } }
From source file:de.xplib.xdbm.ui.dialog.FirstStartSetup.java
/** * @param aeIn .../* ww w . j av a 2 s.c o m*/ * @return Does the test fail or run? */ private boolean actionPerformedTest(final ActionEvent aeIn) { Locale l = this.config.getLocale(); try { String jar = jfField.getText(); if (!jar.startsWith("file://")) { jar = "file://" + jar; } URLClassLoader ucl = new URLClassLoader(new URL[] { new URL(jar) }); Class clazz = ucl.loadClass(jtfClass.getText()); Database db = (Database) clazz.newInstance(); DatabaseManager.registerDatabase(db); String uri = this.jtfDbURI.getText().trim(); if (uri != null && !uri.equals("")) { try { Collection coll = DatabaseManager.getCollection(uri); coll.close(); } catch (XMLDBException e1) { throw new Exception( MessageManager.getText("setup.dialog.test.error.uri", "text", new Object[] { uri }, l)); } } return true; } catch (Exception e) { String msg = "<html>" + MessageManager.getText("setup.dialog.test.error.label", "text", new Object[0], l) + "<br>" + e.getMessage() + "</html>"; String title = MessageManager.getText("setup.dialog.test.error.title", "text", new Object[0], l); JOptionPane.showMessageDialog(this, msg, title, JOptionPane.ERROR_MESSAGE); return false; } }
From source file:gui.AdministracionGrupos.java
public void cargarStick() { stick = new SR232(puertoStick, 3, parent, 1); if (!stick.puertoDisponible()) { JOptionPane.showMessageDialog(this, "No se pudo conectar al puerto serie " + puertoStick + "\n las opciones de entrada estaran deshabilitadas ", gs_mensaje, JOptionPane.ERROR_MESSAGE); return; }//from www . j a va2 s. c o m stick.start(); }
From source file:com.tiempometa.muestradatos.JMuestraDatos.java
private void setDatabase(File database) { ReaderContext.setDatabaseFile(database); try {/*from w ww . ja v a 2 s. c o m*/ JdbcConnector.connect(ReaderContext.getDatabaseFile().getAbsolutePath(), null, null); JOptionPane.showMessageDialog(this, "Se abri exitosamente la base de datos: " + ReaderContext.getDatabaseFile().getName(), "Conexin a base de datos", JOptionPane.INFORMATION_MESSAGE); } catch (InstantiationException | IllegalAccessException | ClassNotFoundException | SQLException e1) { JOptionPane.showMessageDialog(this, "Error conectando a la base de datos " + e1.getMessage(), "Error de base de datos", JOptionPane.ERROR_MESSAGE); } }
From source file:cpsControllers.ConversionController.java
/** * Szczytowy stosunek sygna - szum (PSNR, ang. <i>Peak Signal to Noise * Ratio</i>)/*from w ww . j av a 2 s. co m*/ * * @return */ public double obl_PSNR(ArrayList<Double> pynktyY, ArrayList<Double> _doPorownania) { double wynik = 0; try { if (!pynktyY.isEmpty() && !_doPorownania.isEmpty()) { double licznik = pynktyY.get(0), mianownik = 0; for (int i = 1; i < _doPorownania.size(); i++) { if (licznik < pynktyY.get(i)) { licznik = pynktyY.get(i); } } mianownik = this.obl_MSE(pynktyY, _doPorownania); wynik = licznik / mianownik; wynik = 10.0D * Math.log10(wynik); } else { if (pynktyY.isEmpty()) { JOptionPane.showMessageDialog(null, "Brak sygnau.", "Bd", JOptionPane.ERROR_MESSAGE); } else if (_doPorownania.isEmpty()) { JOptionPane.showMessageDialog(null, "Brak zapisanej konwersji sygnau.", "Bd", JOptionPane.ERROR_MESSAGE); } } } catch (Exception exc_MSE) { // JOptionPane.showMessageDialog(null, "Nie mona obliczy:\n" + exc_MSE.getMessage(), // "Bd", JOptionPane.ERROR_MESSAGE); } System.out.println("PSNR = " + wynik); return wynik; }
From source file:com.devbury.mkremote.server.QuickLaunchServiceImpl.java
protected void handleOpenError(final File file, final Throwable t) { boolean error = true; logger.debug(t.toString());//from w ww . ja va2 s .co m if (isWindows()) { try { runOnWindows(file); error = false; } catch (Throwable w) { logger.debug(w.toString()); } } if (error) { new Thread() { @Override public void run() { JOptionPane.showMessageDialog(null, t.getMessage(), "Error Launching " + file.getAbsolutePath(), JOptionPane.ERROR_MESSAGE); } }.start(); } }
From source file:com.enderville.enderinstaller.ui.Installer.java
private void chooseTargetMinecraftFolder() { JFileChooser chooser = new JFileChooser(); chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); chooser.setMultiSelectionEnabled(false); int opt = chooser.showOpenDialog(getMainPane()); if (opt == JFileChooser.APPROVE_OPTION) { File dir = chooser.getSelectedFile(); String oldDir = InstallerConfig.getMinecraftFolder(); InstallerConfig.setMinecraftFolder(dir.getAbsolutePath()); File mcjar = new File(InstallerConfig.getMinecraftJar()); if (!mcjar.exists()) { JOptionPane.showMessageDialog(getMainPane(), "The installer couldn't find a minecraft installation in the specified folder.\n" + "Restoring minecraft folder to " + oldDir, "Error setting target Minecraft installation", JOptionPane.ERROR_MESSAGE); InstallerConfig.setMinecraftFolder(oldDir); }//from w ww . ja v a 2s. c o m } }
From source file:edu.ucla.stat.SOCR.chart.demo.PowerTransformHistogramChart.java
protected void createActionComponents(JToolBar toolBar) { super.createActionComponents(toolBar); JButton button;//from www. j ava 2s. c om /**************** wiki Tab ****************/ Action linkAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { try { parentApplet.getAppletContext().showDocument(new java.net.URL( "http://wiki.stat.ucla.edu/socr/index.php/SOCR_EduMaterials_Activities_PowerTransformFamily_Graphs"), "SOCR: Power Transform Graphing Activity"); } catch (MalformedURLException Exc) { JOptionPane.showMessageDialog(null, Exc, "MalformedURL Error", JOptionPane.ERROR_MESSAGE); Exc.printStackTrace(); } } }; button = toolBar.add(linkAction); button.setText(" WIKI_Activity "); button.setToolTipText("Press this Button to go to SOCR_POWER_Activity wiki page"); }
From source file:eremeykin.pete.plotter.CartesianPlotterTopComponent.java
@Override public void update() { // for first rpt file if (model == null) { clear();//from w ww. j av a 2 s . co m return; } File[] rptFiles = home.listFiles(filter()); // catch if there is no such file if (rptFiles.length == 0) { clear(); return; } File firstRPT = rptFiles[0]; Scanner scanner; try { scanner = new Scanner(firstRPT); scanner.useDelimiter("\\s+|\n"); } catch (FileNotFoundException ex) { clear(); return; } List<Map.Entry<Double, Double>> tmpList = new ArrayList<>(); for (int i = 0; scanner.hasNext(); i++) { String line = scanner.next(); try { double x1 = Double.valueOf(line); line = scanner.next(); double x2 = Double.valueOf(line); // System.out.println("x1=" + x1 + "\nx2=" + x2); tmpList.add(new AbstractMap.SimpleEntry<>(x1, x2)); } catch (NumberFormatException ex) { // only if it is the third or following line if (i > 1) { LOGGER.error("Error while parsing double from file: " + firstRPT.getAbsolutePath()); JOptionPane.showMessageDialog(this, "Error while parsing result file.", "Parsing error", JOptionPane.ERROR_MESSAGE); } } } if (tmpList.isEmpty()) { clear(); return; } fillData(tmpList); }