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:de.ep3.ftpc.controller.portal.CrawlerDownloadController.java
@Override public void mouseClicked(MouseEvent e) { CrawlerResultsItem.PreviewPanel previewPanel = (CrawlerResultsItem.PreviewPanel) e.getSource(); CrawlerResult crawlerResult = previewPanel.getCrawlerResult(); CrawlerFile crawlerFile = crawlerResult.getFile(); FTPClient ftpClient = crawlerResult.getFtpClient(); if (ftpClient.isConnected()) { JOptionPane.showMessageDialog(portalFrame, i18n.translate("crawlerDownloadWhileConnected"), null, JOptionPane.ERROR_MESSAGE); return;// w ww.ja va 2 s. c o m } String fileExtension = crawlerFile.getExtension(); JFileChooser chooser = new JFileChooser(); FileNameExtensionFilter chooserFilter = new FileNameExtensionFilter( i18n.translate("fileType", fileExtension.toUpperCase()), crawlerFile.getExtension()); chooser.setApproveButtonText(i18n.translate("buttonSave")); chooser.setDialogTitle(i18n.translate("fileDownloadTo")); chooser.setDialogType(JFileChooser.SAVE_DIALOG); chooser.setFileFilter(chooserFilter); chooser.setSelectedFile(new File(crawlerFile.getName())); int selection = chooser.showSaveDialog(portalFrame); if (selection == JFileChooser.APPROVE_OPTION) { File fileToSave = chooser.getSelectedFile(); Server relatedServer = crawlerResult.getServer(); try { ftpClient.connect(relatedServer.need("server.ip"), Integer.parseInt(relatedServer.need("server.port"))); int replyCode = ftpClient.getReplyCode(); if (!FTPReply.isPositiveCompletion(replyCode)) { throw new IOException(i18n.translate("crawlerServerRefused")); } if (relatedServer.has("user.name")) { String userName = relatedServer.get("user.name"); String userPassword = ""; if (relatedServer.hasTemporary("user.password")) { userPassword = relatedServer.getTemporary("user.password"); } boolean loggedIn = ftpClient.login(userName, userPassword); if (!loggedIn) { throw new IOException(i18n.translate("crawlerServerAuthFail")); } } ftpClient.setFileType(FTP.BINARY_FILE_TYPE); /* Download file */ InputStream is = ftpClient.retrieveFileStream(crawlerFile.getFullName()); if (is != null) { byte[] rawFile = new byte[(int) crawlerFile.getSize()]; int i = 0; while (true) { int b = is.read(); if (b == -1) { break; } rawFile[i] = (byte) b; i++; /* Occasionally update the download progress */ if (i % 1024 == 0) { int progress = Math.round((((float) i) / crawlerFile.getSize()) * 100); status.add(i18n.translate("crawlerDownloadProgress", progress)); } } is.close(); is = null; if (!ftpClient.completePendingCommand()) { throw new IOException(); } Files.write(fileToSave.toPath(), rawFile); } /* Logout and disconnect */ ftpClient.logout(); tryDisconnect(ftpClient); status.add(i18n.translate("crawlerDownloadDone")); } catch (IOException ex) { tryDisconnect(ftpClient); JOptionPane.showMessageDialog(portalFrame, i18n.translate("crawlerDownloadFailed", ex.getMessage()), null, JOptionPane.ERROR_MESSAGE); } } }
From source file:com.redpill_linpro.libreoffice.LibreOfficeLauncherLinuxImpl.java
@Override public void launchLibreOffice(String cmisUrl, String repositoryId, String filePath, String webdavUrl) { Runtime rt = Runtime.getRuntime(); try {/* w w w .j av a 2s . c om*/ String params; if (null != webdavUrl && webdavUrl.length() > 0) { params = LibreOfficeLauncherHelper.generateLibreOfficeWebdavOpenUrl(webdavUrl); } else { params = LibreOfficeLauncherHelper.generateLibreOfficeCmisOpenUrl(cmisUrl, repositoryId, filePath); } StringBuffer cmd = new StringBuffer(); try { String[] binaryLocations = { "soffice", "/usr/bin/soffice" }; for (int i = 0; i < binaryLocations.length; i++) { cmd.append((i == 0 ? "" : " || ") + binaryLocations[i] + " \"" + params + "\" "); } System.out.println("Command: sh -c " + cmd); rt.exec(new String[] { "sh", "-c", cmd.toString() }); System.out.println("Process started"); } catch (IOException e) { JOptionPane.showMessageDialog(null, "Failed to start LibreOffice, commandline: " + cmd.toString(), "Error", JOptionPane.ERROR_MESSAGE); e.printStackTrace(); } } catch (UnsupportedEncodingException e1) { JOptionPane.showMessageDialog(null, "Invalid URL for LibreOffice", "Error", JOptionPane.ERROR_MESSAGE); e1.printStackTrace(); } }
From source file:br.com.topsys.cd.applet.AssinaturaApplet.java
public String assinar(String dados) { String retorno = null;//from w w w . j a v a2s. c o m try { X509Certificado certificadoAux = new X509Certificado(Base64.decodeBase64(this.certificado)); if (certificadoAux.equals(this.certificadoDigital.getX509Certificado())) { if (super.flagListaCertificado) { Gson gson = new Gson(); Map<Long, String> map = gson.fromJson(dados, HashMap.class); for (Map.Entry<Long, String> entry : map.entrySet()) { entry.setValue(new AssinaturaDigital().assinar(this.certificadoDigital, entry.getValue())); } retorno = gson.toJson(map); } else { retorno = new AssinaturaDigital().assinar(this.certificadoDigital, dados); } } else { JOptionPane.showMessageDialog(null, "Certificado digital diferente do usurio do sistema!", "Aviso", JOptionPane.ERROR_MESSAGE); } } catch (CertificadoDigitalException | ExcecaoX509 ex) { JOptionPane.showMessageDialog(null, ex.getMessage(), "Aviso", JOptionPane.ERROR_MESSAGE); this.closeError(); } return retorno; }
From source file:com.emr.schemas.SavedProcessesDataMover.java
/** * Constructor/*from www. j a va2s.c o m*/ */ public SavedProcessesDataMover() { initComponents(); this.setClosable(true); final Action processDelete = new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { JTable table = (JTable) e.getSource(); int modelRow = Integer.valueOf(e.getActionCommand()); String foreignKeysTable = (String) tblProcesses.getModel().getValueAt(modelRow, 0); if (foreignKeysTable == null || "".equals(foreignKeysTable)) { JOptionPane.showMessageDialog(null, "Table is Empty", "Empty Table", JOptionPane.ERROR_MESSAGE); } else { } } }; final SQLiteGetProcesses sp = new SQLiteGetProcesses(); sp.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent event) { switch (event.getPropertyName()) { case "progress": System.out.println("Fetching data from db"); break; case "state": switch ((SwingWorker.StateValue) event.getNewValue()) { case DONE: try { model = sp.get(); tblProcesses.setModel(model); tblProcesses.getColumnModel().getColumn(0).setMaxWidth(300); //hide irrelevant columns tblProcesses.getColumnModel().getColumn(2).setMinWidth(0); tblProcesses.getColumnModel().getColumn(2).setMaxWidth(0); tblProcesses.getColumnModel().getColumn(3).setMinWidth(0); tblProcesses.getColumnModel().getColumn(3).setMaxWidth(0); tblProcesses.getColumnModel().getColumn(4).setMinWidth(0); tblProcesses.getColumnModel().getColumn(4).setMaxWidth(0); tblProcesses.getColumnModel().getColumn(5).setMinWidth(0); tblProcesses.getColumnModel().getColumn(5).setMaxWidth(0); tblProcesses.getColumnModel().getColumn(6).setMinWidth(0); tblProcesses.getColumnModel().getColumn(6).setMaxWidth(0); ButtonColumn buttonColumn = new ButtonColumn(tblProcesses, processDelete, 7, "Delete"); } catch (final CancellationException ex) { Logger.getLogger(SavedProcessesDataMover.class.getName()).log(Level.SEVERE, null, ex); } catch (InterruptedException ex) { Logger.getLogger(SavedProcessesDataMover.class.getName()).log(Level.SEVERE, null, ex); } catch (ExecutionException ex) { Logger.getLogger(SavedProcessesDataMover.class.getName()).log(Level.SEVERE, null, ex); } break; } break; } } }); sp.execute(); tblProcesses.addMouseListener(new MouseListener() { @Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { JTable target = (JTable) e.getSource(); int rowIndex = target.getSelectedRow(); String selectQry = (String) target.getModel().getValueAt(rowIndex, 2); String destinationTable = (String) target.getModel().getValueAt(rowIndex, 3); String truncateFirst = (String) target.getModel().getValueAt(rowIndex, 4); String destinationColumns = (String) target.getModel().getValueAt(rowIndex, 5); String columnsToBeMapped = (String) target.getModel().getValueAt(rowIndex, 6); lblUpdateText.setText("<html><b color='red'>Moving Data</b></html>"); dbProgressBar.setIndeterminate(true); new DBUpdater(selectQry, destinationTable, truncateFirst, destinationColumns, columnsToBeMapped) .execute(); } } @Override public void mousePressed(MouseEvent e) { //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public void mouseReleased(MouseEvent e) { //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public void mouseEntered(MouseEvent e) { //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public void mouseExited(MouseEvent e) { //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } }); }
From source file:com.jug.MotherMachine.java
/** * PROJECT MAIN//from w ww .j a v a2 s .c o m * ============ * * @param args * muh! */ public static void main(final String[] args) { try { final MotherMachine main = new MotherMachine(); guiFrame = new JFrame("Interactive MotherMachine"); main.initMainWindow(guiFrame); props = main.loadParams(); BGREM_TEMPLATE_XMIN = Integer .parseInt(props.getProperty("BGREM_TEMPLATE_XMIN", Integer.toString(BGREM_TEMPLATE_XMIN))); BGREM_TEMPLATE_XMAX = Integer .parseInt(props.getProperty("BGREM_TEMPLATE_XMAX", Integer.toString(BGREM_TEMPLATE_XMAX))); BGREM_X_OFFSET = Integer .parseInt(props.getProperty("BGREM_X_OFFSET", Integer.toString(BGREM_X_OFFSET))); GL_OFFSET_BOTTOM = Integer .parseInt(props.getProperty("GL_OFFSET_BOTTOM", Integer.toString(GL_OFFSET_BOTTOM))); GL_OFFSET_TOP = Integer.parseInt(props.getProperty("GL_OFFSET_TOP", Integer.toString(GL_OFFSET_TOP))); GL_OFFSET_LATERAL = Integer .parseInt(props.getProperty("GL_OFFSET_LATERAL", Integer.toString(GL_OFFSET_LATERAL))); MIN_CELL_LENGTH = Integer .parseInt(props.getProperty("MIN_CELL_LENGTH", Integer.toString(MIN_CELL_LENGTH))); MIN_GAP_CONTRAST = Double .parseDouble(props.getProperty("MIN_GAP_CONTRAST", Double.toString(MIN_GAP_CONTRAST))); SIGMA_PRE_SEGMENTATION_X = Double.parseDouble( props.getProperty("SIGMA_PRE_SEGMENTATION_X", Double.toString(SIGMA_PRE_SEGMENTATION_X))); SIGMA_PRE_SEGMENTATION_Y = Double.parseDouble( props.getProperty("SIGMA_PRE_SEGMENTATION_Y", Double.toString(SIGMA_PRE_SEGMENTATION_Y))); SIGMA_GL_DETECTION_X = Double .parseDouble(props.getProperty("SIGMA_GL_DETECTION_X", Double.toString(SIGMA_GL_DETECTION_X))); SIGMA_GL_DETECTION_Y = Double .parseDouble(props.getProperty("SIGMA_GL_DETECTION_Y", Double.toString(SIGMA_GL_DETECTION_Y))); DEFAULT_PATH = props.getProperty("DEFAULT_PATH", DEFAULT_PATH); GUI_POS_X = Integer.parseInt(props.getProperty("GUI_POS_X", Integer.toString(DEFAULT_GUI_POS_X))); GUI_POS_Y = Integer.parseInt(props.getProperty("GUI_POS_Y", Integer.toString(DEFAULT_GUI_POS_X))); GUI_WIDTH = Integer.parseInt(props.getProperty("GUI_WIDTH", Integer.toString(GUI_WIDTH))); GUI_HEIGHT = Integer.parseInt(props.getProperty("GUI_HEIGHT", Integer.toString(GUI_HEIGHT))); GUI_CONSOLE_WIDTH = Integer .parseInt(props.getProperty("GUI_CONSOLE_WIDTH", Integer.toString(GUI_CONSOLE_WIDTH))); // Iterate over all currently attached monitors and check if sceen position is actually possible, // otherwise fall back to the DEFAULT values and ignore the ones coming from the properties-file. boolean pos_ok = false; final GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); final GraphicsDevice[] gs = ge.getScreenDevices(); for (int i = 0; i < gs.length; i++) { final DisplayMode dm = gs[i].getDisplayMode(); if (gs[i].getDefaultConfiguration().getBounds() .contains(new java.awt.Point(GUI_POS_X, GUI_POS_Y))) { pos_ok = true; } } // None of the screens contained the top-left window coordinates --> fall back onto default values... if (!pos_ok) { GUI_POS_X = DEFAULT_GUI_POS_X; GUI_POS_Y = DEFAULT_GUI_POS_Y; } String path = props.getProperty("import_path", System.getProperty("user.home")); final File fPath = main.showStartupDialog(guiFrame, path); path = fPath.getAbsolutePath(); props.setProperty("import_path", fPath.getAbsolutePath()); // Setting up console window and window snapper... main.initConsoleWindow(); main.showConsoleWindow(); final JFrameSnapper snapper = new JFrameSnapper(); snapper.addFrame(main.frameConsoleWindow); snapper.addFrame(guiFrame); // --------------------------------------------------- main.processDataFromFolder(path); // --------------------------------------------------- System.out.print("Build and show GUI..."); // show loaded and annotated data ImageJFunctions.show(main.imgRaw, "Rotated & cropped raw data"); ImageJFunctions.show(main.imgTemp, "Temporary"); ImageJFunctions.show(main.imgAnnotated, "Annotated ARGB data"); final MotherMachineGui gui = new MotherMachineGui(new MotherMachineModel(main)); gui.setVisible(true); main.ij = new ImageJ(); guiFrame.add(gui); guiFrame.setSize(GUI_WIDTH, GUI_HEIGHT); guiFrame.setLocation(GUI_POS_X, GUI_POS_Y); guiFrame.setVisible(true); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { snapper.snapFrames(main.frameConsoleWindow, guiFrame, JFrameSnapper.EAST); } }); System.out.println(" done!"); } catch (final UnsatisfiedLinkError ulr) { JOptionPane.showMessageDialog(MotherMachine.guiFrame, "Could initialize Gurobi.\n" + "You might not have installed Gurobi properly or you miss a valid license.\n" + "Please visit 'www.gurobi.com' for further information.\n\n" + ulr.getMessage(), "Gurobi Error?", JOptionPane.ERROR_MESSAGE); } }
From source file:Main.StaticTools.java
/** * Open up a <code> JOptionPane </code> with the given parameters * @param source description where the Exception is coming from, used as the header of the Pane * @param e the Exception which was thrown, will be prompted as the text of the Pane *//*w w w . jav a2 s . c om*/ public static void errorOut(String source, Exception e) { JOptionPane.showMessageDialog(null, "From :" + source + "\nMessage: " + e.toString(), "Error", JOptionPane.ERROR_MESSAGE); }
From source file:com.redpill_linpro.libreoffice.LibreOfficeLauncherWindowsImpl.java
@Override public void launchLibreOffice(String cmisUrl, String repositoryId, String filePath, String webdavUrl) { Runtime rt = Runtime.getRuntime(); try {/*from w ww . j a v a 2 s . com*/ String params; if (null != webdavUrl && webdavUrl.length() > 0) { params = LibreOfficeLauncherHelper.generateLibreOfficeWebdavOpenUrl(webdavUrl); } else { params = LibreOfficeLauncherHelper.generateLibreOfficeCmisOpenUrl(cmisUrl, repositoryId, filePath); } StringBuffer cmd = new StringBuffer(); try { String[] binaryLocations = { "start soffice.exe" }; for (int i = 0; i < binaryLocations.length; i++) { cmd.append((i == 0 ? "" : " || ") + binaryLocations[i] + " \"" + params + "\" "); } System.out.println("Command: cmd.exe /C " + cmd); rt.exec(new String[] { "cmd.exe", "/C", cmd.toString() }); System.out.println("Process started"); } catch (IOException e) { JOptionPane.showMessageDialog(null, "Failed to start LibreOffice, commandline: " + cmd.toString() + "" + e.toString(), "Error", JOptionPane.ERROR_MESSAGE); e.printStackTrace(); } } catch (UnsupportedEncodingException e1) { JOptionPane.showMessageDialog(null, "Invalid URL for LibreOffice", "Error", JOptionPane.ERROR_MESSAGE); e1.printStackTrace(); } }
From source file:com.k42b3.sacmis.ExecutorAbstract.java
public void run() { try {// w w w. j ava 2 s .c o m // clear text this.textArea.setText(""); CommandLine commandLine = CommandLine.parse(this.getExecutable() + " " + this.cmd); ExecuteWatchdog watchdog = new ExecuteWatchdog(ExecuteWatchdog.INFINITE_TIMEOUT); // create executor DefaultExecutor executor = new DefaultExecutor(); executor.setStreamHandler(new PumpStreamHandler(new TextAreaOutputStream(textArea))); executor.setWatchdog(watchdog); executor.execute(commandLine); } catch (FoundNoExecutableException e) { JOptionPane.showMessageDialog(null, e.getMessage(), "Information", JOptionPane.ERROR_MESSAGE); } catch (IOException e) { logger.error(e.getMessage(), e); } }
From source file:sistemacontrole.LeituraEscritaCanais.java
LeituraEscritaCanais(LoginWindow loginWindow, MainWindow mainWindow) { //setar views this.loginWindow = loginWindow; this.mainWindow = mainWindow; this.plantaSimulacao = new Simulacao(); //checar se foi login offline this.isOffline = this.loginWindow.isOffline(); //cria a conexo com a planta caso no seja offline if (!this.isOffline) { try {/* w w w.j a v a 2 s. co m*/ this.quanserClient = new QuanserClient(this.loginWindow.GetIP(), this.loginWindow.GetPorta()); } catch (QuanserClientException ex) { JOptionPane.showMessageDialog(this.loginWindow, "Erro ao se conectar a planta!", "Erro!", JOptionPane.ERROR_MESSAGE); System.out.println("Erro ao se conectar a planta!"); } } else { JOptionPane.showMessageDialog(this.loginWindow, "Planta no conectada! \nModo de simulao ativado.", "Ateno!", JOptionPane.WARNING_MESSAGE); this.mainWindow.setTitle(this.mainWindow.getTitle() + " (Offline)"); } //varivel de tempo global para grfico this.tempoGlobal = 0; //inicializar curvas dos grficos this.sinal_calculado = new XYSeries("Saida 0 - Calculado"); this.sinal_tratado = new XYSeries("Saida 0 - Tratada"); this.sinal_entrada = new XYSeries[7]; this.valor_P = new XYSeries("Parametro P"); this.valor_I = new XYSeries("Parametro I"); this.valor_D = new XYSeries("Parametro D"); this.erro_PID = new XYSeries("Erro calculado"); this.setPointCurva = new XYSeries("Set Point"); for (int i = 0; i < 7; ++i) { this.sinal_entrada[i] = new XYSeries("Canal " + i); } //iniciar tempo global tempoInicial = System.nanoTime(); //inicializao de threads this.relogio = new Thread(new atualizarTempoGlobal());//inicializar contador de tempo new Thread(new atualizarGraficos()).start();//inicializar atualizao dos grficos new Thread(new getCanaisValores()).start();//inicializar leitura dos canais //objetos de sincronizao de leitura e escrita de canal leituraEscrita = new leituraEscritaSync(); }
From source file:namedatabasescraper.NameDatabaseScraper.java
public void shutdown() { try {//from www . jav a 2 s .co m this.saveProperties(); } catch (IOException ex) { JOptionPane.showMessageDialog(null, Utils.wordWrapString("Could not store properties: " + ex.getMessage(), 50), "Property storage failure", JOptionPane.ERROR_MESSAGE); } try { this.connection.close(); } catch (SQLException ex) { JOptionPane.showMessageDialog(null, Utils.wordWrapString("Could not close the database: " + ex.getMessage(), 50), "Database closing failure", JOptionPane.ERROR_MESSAGE); } logger.info("Exiting NameDatabaseScraper"); System.exit(0); }