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:EnrollFingerprint.Enroll.java
protected void process(DPFPSample sample) { // Show the fingerprint image. drawPicture(convertSampleToBitmap(sample)); // Process the fingerprint and create a feature set form the enrollment purpose. DPFPFeatureSet features = extractFeatures(sample, DPFPDataPurpose.DATA_PURPOSE_ENROLLMENT); // Check quality of the fingerprint and add to enroller if it's good. if (features != null) { try {//from www .j a v a 2 s . c o m makeReport("Creada la caracterizacin de la huella."); enroller.addFeatures(features); } catch (DPFPImageQualityException e) { } finally { updateStatus(); // Check if a template has been created. switch (enroller.getTemplateStatus()) { case TEMPLATE_STATUS_READY: stop(); setTemplate(enroller.getTemplate()); setPrompt("Huela lista para verificar."); btnRead.setEnabled(false); break; case TEMPLATE_STATUS_FAILED: enroller.clear(); stop(); updateStatus(); setTemplate(null); JOptionPane.showMessageDialog(Enroll.this, "La huella capturada no es validad, repita el registro.", "Captura y Registro de huellas", JOptionPane.ERROR_MESSAGE); start(); break; } } } }
From source file:gisintegration.SimpleSwingBrowser.java
private void createScene() { Platform.runLater(new Runnable() { @Override//from w ww.ja v a2 s. c o m public void run() { WebView view = new WebView(); engine = view.getEngine(); // engine.titleProperty().addListener(new ChangeListener<String>() { // @Override // public void changed(ObservableValue<? extends String> observable, String oldValue, final String newValue) { // SwingUtilities.invokeLater(new Runnable() { // @Override // public void run() { // SimpleSwingBrowser.this.setTitle(newValue); // } // }); // } // }); engine.setOnStatusChanged(new EventHandler<WebEvent<String>>() { @Override public void handle(final WebEvent<String> event) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { lblStatus.setText(event.getData()); } }); } }); // engine.locationProperty().addListener(new ChangeListener<String>() { // @Override // public void changed(ObservableValue<? extends String> ov, String oldValue, final String newValue) { // SwingUtilities.invokeLater(new Runnable() { // @Override // public void run() { // txtURL.setText(newValue); // } // }); // } // }); engine.getLoadWorker().workDoneProperty().addListener(new ChangeListener<Number>() { @Override public void changed(ObservableValue<? extends Number> observableValue, Number oldValue, final Number newValue) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { progressBar.setValue(newValue.intValue()); } }); } }); engine.getLoadWorker().exceptionProperty().addListener(new ChangeListener<Throwable>() { public void changed(ObservableValue<? extends Throwable> o, Throwable old, final Throwable value) { if (engine.getLoadWorker().getState() == FAILED) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { JOptionPane.showMessageDialog(panel, (value != null) ? engine.getLocation() + "\n" + value.getMessage() : engine.getLocation() + "\nUnexpected error.", "Loading error...", JOptionPane.ERROR_MESSAGE); } }); } } }); jfxPanel.setScene(new Scene(view)); } }); }
From source file:appmain.AppMain.java
private List<String> readXMLData(File xml) { try {/* w w w . j a v a 2 s . c om*/ List<String> transactions = new ArrayList<>(); Document xmlDoc = jdomBuilder.build(xml); Element report = xmlDoc.getRootElement(); ElementFilter filter = new ElementFilter("G_TR"); Iterator<Element> c = report.getDescendants(filter); while (c.hasNext()) { Element e = c.next(); transactions.add(processTransactionElement(e)); } return transactions; } catch (JDOMException | IOException ex) { JOptionPane.showMessageDialog(null, "Hiba az XML fjl feldolgozsa kzben!\n" + ExceptionUtils.getStackTrace(ex) + "Fjl: " + xml.getAbsolutePath(), "Hiba", JOptionPane.ERROR_MESSAGE); } return null; }
From source file:org.cytoscape.dyn.internal.graphMetrics.SaveChartDialog.java
@Override public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub if (e.getSource() == cancelButton) { this.setVisible(false); this.dispose(); } else if (e.getSource() == saveChartButton) { JFileChooser saveFileDialog = new JFileChooser(); saveFileDialog//from ww w . j a va 2 s.com .addChoosableFileFilter(new ExtensionFileFilter(".jpeg", ".jpg", "Jpeg images (.jpeg, .jpg)")); saveFileDialog.addChoosableFileFilter( new ExtensionFileFilter(".png", "Portable Network Graphic images (.png)")); saveFileDialog .addChoosableFileFilter(new ExtensionFileFilter(".svg", "Scalable Vector Graphics (.svg)")); int save = saveFileDialog.showSaveDialog(this); if (save == JFileChooser.APPROVE_OPTION) { File file = saveFileDialog.getSelectedFile(); int width = ((SpinnerNumberModel) widthSpinner.getModel()).getNumber().intValue(); int height = ((SpinnerNumberModel) heightSpinner.getModel()).getNumber().intValue(); ExtensionFileFilter filter = null; try { filter = (ExtensionFileFilter) saveFileDialog.getFileFilter(); if (!filter.hasExtension(file)) { file = filter.appendExtension(file); } } catch (ClassCastException ex) { // Try to infer the type of file by its extension FileFilter[] filters = saveFileDialog.getChoosableFileFilters(); for (int i = 0; i < filters.length; ++i) { if (filters[i] instanceof ExtensionFileFilter) { filter = (ExtensionFileFilter) filters[i]; if (filter.hasExtension(file)) { break; } filter = null; } } if (filter == null) { // Could not infer the type JOptionPane.showMessageDialog(null, "File type not specified!\nWhen giving file name, please also select one of the supported file types.", "Error", JOptionPane.ERROR_MESSAGE); return; } } // Save the chart to the specified file name try { String ext = filter.getExtension(); if (ext.equals("jpeg")) { ChartUtilities.saveChartAsJPEG(file, chart, width, height); } else if (ext.equals("png")) { ChartUtilities.saveChartAsPNG(file, chart, width, height); } else { VectorGraphics graphics = new SVGGraphics2D(file, new Dimension(width, height)); graphics.startExport(); chart.draw(graphics, new Rectangle2D.Double(0, 0, width, height)); graphics.endExport(); } } catch (IOException ex) { JOptionPane.showMessageDialog(null, "An error occurred while creating or writing to the file.", "Error", JOptionPane.ERROR_MESSAGE); return; } this.setVisible(false); this.dispose(); } else if (save == JFileChooser.ERROR_OPTION) { JOptionPane.showMessageDialog(null, "An error occurred while initializing the window.", "Error", JOptionPane.ERROR_MESSAGE); } } }
From source file:de.fionera.javamailer.gui.mainView.controllerMain.java
/** * Adds the Actionlisteners to the Mainview * * @param viewMain The Mainview/*from w w w. j a va 2 s . c om*/ */ private void addActionListener(viewMain viewMain) { /** * Changes the Amount in the AmountLabel when the slider is moved */ viewMain.getSetMailSettingsPanel().getSliderAmountMails().addChangeListener(e -> { Main.amountMails = ((JSlider) e.getSource()).getValue(); viewMain.getSetMailSettingsPanel().getLabelNumberAmountMails() .setText("" + ((JSlider) e.getSource()).getValue()); }); /** * Changes the Delay in the DelayLabel when the slider is moved */ viewMain.getSetMailSettingsPanel().getSliderDelayMails().addChangeListener(e -> { Main.delayMails = ((JSlider) e.getSource()).getValue(); viewMain.getSetMailSettingsPanel().getLabelNumberDelayMails() .setText("" + ((JSlider) e.getSource()).getValue()); }); /** * Closes the Program, when close is clicked */ viewMain.getCloseItem().addActionListener(e -> System.exit(0)); /** * Opens the Settings when the settingsbutton is clicked */ viewMain.getSettingsItem().addActionListener(e -> new controllerSettings()); /** * Save current Setup */ viewMain.getSaveSettings().addActionListener(e -> { JFileChooser jChooser = new JFileChooser(); JFrame parentFrame = new JFrame(); FileNameExtensionFilter filter = new FileNameExtensionFilter("Setup file", "jms", "Blub"); jChooser.setFileFilter(filter); jChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); jChooser.setDialogTitle("Select Setup"); int userSelection = jChooser.showSaveDialog(parentFrame); if (userSelection == JFileChooser.APPROVE_OPTION) { File fileToSave = new File(jChooser.getSelectedFile() + ".jms"); saveSetup(viewMain, fileToSave, new ObjectMapper()); } }); /** * Load Setup */ viewMain.getLoadSettings().addActionListener(e -> { JFileChooser jChooser = new JFileChooser(); FileNameExtensionFilter filter = new FileNameExtensionFilter("Setup file", "jms", "Blub"); jChooser.setFileFilter(filter); jChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); jChooser.setDialogTitle("Select Setup"); jChooser.showOpenDialog(null); File file = jChooser.getSelectedFile(); if (file != null) { if (file.getName().endsWith("jms")) { try { loadSetup(viewMain, file, new ObjectMapper()); } catch (Exception error) { error.printStackTrace(); } } } }); /** * Opens the Open File dialog and start the Parsing of it */ viewMain.getSelectRecipientsPanel().getSelectExcelFileButton().addActionListener(e -> { DefaultTableModel model; JFileChooser jChooser = new JFileChooser(); jChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); jChooser.addChoosableFileFilter(new FileNameExtensionFilter("Microsoft Excel 97 - 2003 (.xls)", "xls")); jChooser.addChoosableFileFilter(new FileNameExtensionFilter("Microsoft Excel (.xlsx)", "xlsx")); jChooser.setDialogTitle("Select only Excel workbooks"); jChooser.showOpenDialog(null); File file = jChooser.getSelectedFile(); if (file != null) { parseFilesForImport parseFilesForImport = new parseFilesForImport(); if (file.getName().endsWith("xls")) { ArrayList returnedData = parseFilesForImport.parseXLSFile(file); model = new DefaultTableModel((String[][]) returnedData.get(0), (String[]) returnedData.get(1)); int tableWidth = model.getColumnCount() * 150; int tableHeight = model.getRowCount() * 25; viewMain.getSelectRecipientsPanel().getTable() .setPreferredSize(new Dimension(tableWidth, tableHeight)); } else if (file.getName().endsWith("xlsx")) { ArrayList returnedData = parseFilesForImport.parseXLSXFile(file); model = new DefaultTableModel((String[][]) returnedData.get(0), (String[]) returnedData.get(1)); int tableWidth = model.getColumnCount() * 150; int tableHeight = model.getRowCount() * 25; viewMain.getSelectRecipientsPanel().getTable() .setPreferredSize(new Dimension(tableWidth, tableHeight)); } else { JOptionPane.showMessageDialog(null, "Please select only Excel file.", "Error", JOptionPane.ERROR_MESSAGE); model = new DefaultTableModel(); } } else { model = new DefaultTableModel(); } viewMain.getSelectRecipientsPanel().getTable().setModel(model); int tableWidth = model.getColumnCount() * 150; int tableHeight = model.getRowCount() * 25; viewMain.getSelectRecipientsPanel().getTable().setPreferredSize(new Dimension(tableWidth, tableHeight)); viewMain.getCheckAllSettings().getLabelRecipientsAmount().setText("" + model.getRowCount()); viewMain.getCheckAllSettings().getLabelTimeAmount() .setText("" + viewMain.getSetMailSettingsPanel().getSliderDelayMails().getValue() * viewMain.getSelectRecipientsPanel().getTable().getRowCount() / viewMain.getSetMailSettingsPanel().getSliderAmountMails().getValue() + " Seconds"); }); /** * Starts the sending of th Mails, when the send button is clicked */ viewMain.getCheckAllSettings().getSendMails().addActionListener(e -> { String subject = viewMain.getSetMailSettingsPanel().getFieldSubject().getText(); Sender sender = (Sender) viewMain.getSetMailSettingsPanel().getSelectSender().getSelectedItem(); JTable table = viewMain.getSelectRecipientsPanel().getTable(); if (table != null && sender != null && !subject.equals("")) { new sendMails(viewMain); } }); /** * Clears the Table on buttonclick */ viewMain.getSelectRecipientsPanel().getClearTableButton().addActionListener(e -> { viewMain.getSelectRecipientsPanel().getTable().setModel(new DefaultTableModel()); viewMain.getSelectRecipientsPanel().getTable().setBackground(null); }); /** * Removes a single Row on menu click in the editMailPanel */ viewMain.getSelectRecipientsPanel().getDeleteRow().addActionListener(e -> { ((DefaultTableModel) viewMain.getSelectRecipientsPanel().getTable().getModel()) .removeRow(viewMain.getSelectRecipientsPanel().getTable().getSelectedRowCount()); viewMain.getSelectRecipientsPanel().getTable().setBackground(null); }); /** * The Changes the displayed Value when the Time in the Timespinner is getting changed. */ viewMain.getSetMailSettingsPanel().getTimeSpinner().addChangeListener(e -> { parseDate.parseDate(viewMain); viewMain.getSetMailSettingsPanel().getLabelSendingIn().setText(parseDate.getDays() + " Days, " + parseDate.getHours() + " hours and " + parseDate.getMinutes() + " minutes remaining"); viewMain.getSetMailSettingsPanel().getLabelSendingAt().setText(parseDate.getDate().toString()); viewMain.getSetMailSettingsPanel().setDate(parseDate.getDate()); }); viewMain.getSetMailSettingsPanel().getDatePicker().addActionListener(e -> { parseDate.parseDate(viewMain); viewMain.getSetMailSettingsPanel().getLabelSendingIn().setText(parseDate.getDays() + " Days, " + parseDate.getHours() + " hours and " + parseDate.getMinutes() + " minutes remaining"); viewMain.getSetMailSettingsPanel().getLabelSendingAt().setText(parseDate.getDate().toString()); viewMain.getSetMailSettingsPanel().setDate(parseDate.getDate()); }); /** * Actionevent for the Edit Sender Button */ viewMain.getSetMailSettingsPanel().getButtonEditSender() .addActionListener(e -> new controllerEditSender(controllerMain)); /** * Actionevent for the Import Button in the EditMail View */ viewMain.getEditMailPanel().getImportWord().addActionListener(e -> { JFileChooser jChooser = new JFileChooser(); jChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); jChooser.addChoosableFileFilter(new FileNameExtensionFilter("Microsoft Word 97 - 2003 (.doc)", "doc")); jChooser.addChoosableFileFilter(new FileNameExtensionFilter("HTML File (.html)", "html")); jChooser.setDialogTitle("Select only Word Documents"); jChooser.showOpenDialog(null); File file = jChooser.getSelectedFile(); if (file != null) { parseFilesForImport parseFilesForImport = new parseFilesForImport(); if (file.getName().endsWith("doc")) { String returnedData = parseFilesForImport.parseDOCFile(file); viewMain.getEditMailPanel().setEditorText(returnedData); } else if (file.getName().endsWith("html")) { String content = ""; try { content = Jsoup.parse(file, "UTF-8").toString(); } catch (IOException e1) { e1.printStackTrace(); } viewMain.getEditMailPanel().setEditorText(content); } else { JOptionPane.showMessageDialog(null, "Please select a Document file.", "Error", JOptionPane.ERROR_MESSAGE); } } }); /** * The Tab Changelistener * The first if Statement sets the Labels on the Checkallsettings Panel to the right Values */ viewMain.getTabbedPane().addChangeListener(e -> { if (viewMain.getTabbedPane().getSelectedComponent() == viewMain.getCheckAllSettings()) { viewMain.getCheckAllSettings().getLabelMailBelow() .setText(viewMain.getEditMailPanel().getEditorText()); //Displays the Mail viewMain.getCheckAllSettings().getLabelRecipientsAmount() .setText("" + viewMain.getSelectRecipientsPanel().getTable().getModel().getRowCount()); //Displays the Amount of Recipients if (viewMain.getSetMailSettingsPanel().getSelectSender().getSelectedItem() != null) { viewMain.getCheckAllSettings().getLabelFromInserted().setText( viewMain.getSetMailSettingsPanel().getSelectSender().getSelectedItem().toString()); } else { viewMain.getCheckAllSettings().getLabelFromInserted().setText("Select a Sender first"); } viewMain.getCheckAllSettings().getLabelSubjectInserted() .setText(viewMain.getSetMailSettingsPanel().getFieldSubject().getText()); //Displays the Subject if (viewMain.getSetMailSettingsPanel().getCheckBoxDelayMails().isSelected()) { viewMain.getCheckAllSettings().getLabelDelay().setVisible(true); viewMain.getCheckAllSettings().getLabelAmount().setVisible(true); viewMain.getCheckAllSettings().getLabelTime().setVisible(true); viewMain.getCheckAllSettings().getLabelDelayNumber().setVisible(true); viewMain.getCheckAllSettings().getLabelAmountNumber().setVisible(true); viewMain.getCheckAllSettings().getLabelTimeAmount().setVisible(true); viewMain.getCheckAllSettings().getLabelDelayNumber() .setText("" + viewMain.getSetMailSettingsPanel().getSliderDelayMails().getValue()); //The Delay Number viewMain.getCheckAllSettings().getLabelAmountNumber() .setText("" + viewMain.getSetMailSettingsPanel().getSliderAmountMails().getValue()); //The Amount of Mail in one package viewMain.getCheckAllSettings().getLabelTimeAmount() .setText("" + viewMain.getSetMailSettingsPanel().getSliderDelayMails().getValue() * viewMain.getSelectRecipientsPanel().getTable().getRowCount() / viewMain.getSetMailSettingsPanel().getSliderAmountMails().getValue() + " Seconds"); //The Time the Sending needs } else { viewMain.getCheckAllSettings().getLabelDelay().setVisible(false); viewMain.getCheckAllSettings().getLabelAmount().setVisible(false); viewMain.getCheckAllSettings().getLabelTime().setVisible(false); viewMain.getCheckAllSettings().getLabelDelayNumber().setVisible(false); viewMain.getCheckAllSettings().getLabelAmountNumber().setVisible(false); viewMain.getCheckAllSettings().getLabelTimeAmount().setVisible(false); } if (viewMain.getSetMailSettingsPanel().getCheckBoxSendLater().isSelected()) { viewMain.getCheckAllSettings().getLabelSendingAt().setVisible(true); viewMain.getCheckAllSettings().getLabelSendingWhen().setVisible(true); viewMain.getCheckAllSettings().getLabelSendingAt() .setText(viewMain.getSetMailSettingsPanel().getDate().toString()); } else { viewMain.getCheckAllSettings().getLabelSendingAt().setVisible(false); viewMain.getCheckAllSettings().getLabelSendingWhen().setVisible(false); } } }); }
From source file:be.ugent.maf.cellmissy.gui.controller.load.generic.singlecell.GenericSingleCellImagedPlateController.java
/** * This is parsing a certain file, for a certain selected well and a * wellHasImagingType (i.e. dataset and imaging type are chosen) * * @param trackFile/*www . j a v a 2 s .com*/ * @param newWellHasImagingType * @param selectedWellGui */ public void loadData(File trackFile, WellHasImagingType newWellHasImagingType, WellGui selectedWellGui) { List<WellHasImagingType> wellHasImagingTypes = selectedWellGui.getWell().getWellHasImagingTypeList(); // parse raw data for selected well try { List<Track> tracks = genericInputFileParser.parseTrackFile(trackFile); // set the track list and add the wellHasImagingType to the list newWellHasImagingType.setTrackList(tracks); wellHasImagingTypes.add(newWellHasImagingType); for (Track track : tracks) { track.setWellHasImagingType(newWellHasImagingType); } for (Track track : tracks) { trackPointsBindingList.addAll(track.getTrackPointList()); } } catch (FileParserException ex) { LOG.error(ex.getMessage()); genericImagedPlateController.showMessage(ex.getMessage(), "Generic input file error", JOptionPane.ERROR_MESSAGE); } }
From source file:edu.ku.brc.specify.tasks.subpane.wb.ConfigureXLS.java
public void showBadHeadingsMsg(final Vector<Integer> badHeadingIdxs, final Vector<Integer> emptyCols, final String title) { String colStr = ""; for (int c = 0; c < badHeadingIdxs.size(); c++) { if (c > 0) { colStr += c == badHeadingIdxs.size() - 1 ? " and " : ", "; }/*from w ww . ja v a 2 s . c om*/ int adjust = 1; if (emptyCols != null) { for (Integer ec : emptyCols) { if (ec <= badHeadingIdxs.get(c)) { adjust--; } } colStr += badHeadingIdxs.get(c) + adjust; } } JOptionPane.showMessageDialog(UIRegistry.getTopWindow(), String.format(getResourceString( (badHeadingIdxs.size() == 1 ? "WB_IMPORT_INVALID_COL_HEADER" : "WB_IMPORT_INVALID_COL_HEADERS")), colStr), title, JOptionPane.ERROR_MESSAGE); }
From source file:edu.harvard.mcz.imagecapture.jobs.JobCleanDirectory.java
private List<File> getFileList() { ArrayList<File> files = new ArrayList<File>(); String pathToCheck = ""; // Find the path in which to include files. File imagebase = null; // place to start the scan from, imagebase directory for SCAN_ALL File startPoint = null;//www . jav a 2 s . co m // If it isn't null, retrieve the image base directory from properties, and test for read access. if (Singleton.getSingletonInstance().getProperties().getProperties() .getProperty(ImageCaptureProperties.KEY_IMAGEBASE) == null) { JOptionPane.showMessageDialog(Singleton.getSingletonInstance().getMainFrame(), "Can't start scan. Don't know where images are stored. Set imagbase property.", "Can't Scan.", JOptionPane.ERROR_MESSAGE); } else { imagebase = new File(Singleton.getSingletonInstance().getProperties().getProperties() .getProperty(ImageCaptureProperties.KEY_IMAGEBASE)); if (imagebase != null) { if (imagebase.canRead()) { startPoint = imagebase; } else { // If it can't be read, null out imagebase imagebase = null; } } if (scan == SCAN_SPECIFIC && startPointSpecific != null && startPointSpecific.canRead()) { // A scan start point has been provided, don't launch a dialog. startPoint = startPointSpecific; } if (imagebase == null || scan == SCAN_SELECT) { // launch a file chooser dialog to select the directory to scan final JFileChooser fileChooser = new JFileChooser(); fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); if (scan == SCAN_SELECT && startPointSpecific != null && startPointSpecific.canRead()) { fileChooser.setCurrentDirectory(startPointSpecific); } else { if (Singleton.getSingletonInstance().getProperties().getProperties() .getProperty(ImageCaptureProperties.KEY_LASTPATH) != null) { fileChooser.setCurrentDirectory(new File(Singleton.getSingletonInstance().getProperties() .getProperties().getProperty(ImageCaptureProperties.KEY_LASTPATH))); } } int returnValue = fileChooser.showOpenDialog(Singleton.getSingletonInstance().getMainFrame()); if (returnValue == JFileChooser.APPROVE_OPTION) { File file = fileChooser.getSelectedFile(); log.debug("Selected base directory: " + file.getName() + "."); startPoint = file; } else { //TODO: handle error condition log.error("Directory selection cancelled by user."); } } // Check that startPoint is or is within imagebase. if (!ImageCaptureProperties.isInPathBelowBase(startPoint)) { String base = Singleton.getSingletonInstance().getProperties().getProperties() .getProperty(ImageCaptureProperties.KEY_IMAGEBASE); log.error("Tried to scan directory (" + startPoint.getPath() + ") outside of base image directory (" + base + ")"); String message = "Can't scan and cleanup files outside of base image directory (" + base + ")"; JOptionPane.showMessageDialog(Singleton.getSingletonInstance().getMainFrame(), message, "Can't Scan outside image base directory.", JOptionPane.YES_NO_OPTION); } else if (ImageCaptureProperties.getPathBelowBase(startPoint).trim().length() == 0) { String base = Singleton.getSingletonInstance().getProperties().getProperties() .getProperty(ImageCaptureProperties.KEY_IMAGEBASE); log.error("Tried to scan directory (" + startPoint.getPath() + ") which is the base image directory."); String message = "Can only scan and cleanup files in a selected directory within the base directory (" + base + ").\nYou must select some subdirectory within the base directory to cleanup."; JOptionPane.showMessageDialog(Singleton.getSingletonInstance().getMainFrame(), message, "Can't Cleanup image base directory.", JOptionPane.YES_NO_OPTION); } else { if (!startPoint.canRead()) { JOptionPane.showMessageDialog(Singleton.getSingletonInstance().getMainFrame(), "Can't start scan. Unable to read selected directory: " + startPoint.getPath(), "Can't Scan.", JOptionPane.YES_NO_OPTION); } else { pathToCheck = ImageCaptureProperties.getPathBelowBase(startPoint); // retrieve a list of image records in the selected directory ICImageLifeCycle ils = new ICImageLifeCycle(); List<ICImage> images = ils.findAllInDir(pathToCheck); Iterator<ICImage> iter = images.iterator(); while (iter.hasNext()) { ICImage image = iter.next(); File imageFile = new File( ImageCaptureProperties.assemblePathWithBase(image.getPath(), image.getFilename())); files.add(imageFile); counter.incrementFilesSeen(); } } } } log.debug("Found " + files.size() + " Image files in directory to check."); return files; }
From source file:com.emental.mindraider.ui.dialogs.ConnectUriqaServerJDialog.java
/** * Connect.// w ww. ja va2 s .co m */ protected void connect() { String modelUrl = uriqaServerUrl.getText(); if (StringUtils.isEmpty(modelUrl)) { StatusBar.show(Messages.getString("ConnectUriqaServerJDialog.invalidModelLocation"), Color.RED); } else { try { logger.debug(addInfered.isSelected()); // call uriqa URI builder; load model from that URI (and than // look in click handler) UriqaClient.establishConnection(uriqaServerUrl.getText(), addInfered.isSelected()); MindRaider.spidersGraph .load(UriqaClient.getResourceRepresentationUrl((String) resourceUri.getSelectedItem())); } catch (Exception e) { logger.debug(Messages.getString("ConnectUriqaServerJDialog.unableToConnect", e.getMessage())); dispose(); JOptionPane.showMessageDialog(this, Messages.getString("ConnectUriqaServerJDialog.unableToConnect", e.getMessage()), Messages.getString("ConnectUriqaServerJDialog.uricaServerError"), JOptionPane.ERROR_MESSAGE); return; } StatusBar.show(Messages.getString("ConnectUriqaServerJDialog.modelDownloaded", modelUrl)); } dispose(); }
From source file:fll.subjective.SubjectiveFrame.java
/** * Create a window to edit subjective scores. *//*w ww .java 2 s . c o m*/ public SubjectiveFrame() { super("Subjective Score Entry"); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); getContentPane().setLayout(new BorderLayout()); final JPanel topPanel = new JPanel(); getContentPane().add(topPanel, BorderLayout.NORTH); final JButton quitButton = new JButton("Quit"); topPanel.add(quitButton); quitButton.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent ae) { quit(); } }); final JButton saveButton = new JButton("Save"); topPanel.add(saveButton); saveButton.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent ae) { try { save(); } catch (final IOException ioe) { JOptionPane.showMessageDialog(null, "Error writing to data file: " + ioe.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } }); final JButton summaryButton = new JButton("Summary"); topPanel.add(summaryButton); summaryButton.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent ae) { final SummaryDialog dialog = new SummaryDialog(SubjectiveFrame.this); dialog.pack(); dialog.setVisible(true); } }); final JButton compareButton = new JButton("Compare Scores"); topPanel.add(compareButton); compareButton.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent ae) { final File compareFile = chooseSubjectiveFile("Choose the file to compare with"); if (null != compareFile) { try { save(); } catch (final IOException ioe) { JOptionPane.showMessageDialog(null, "Error writing to data file: " + ioe.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } try { final Collection<SubjectiveScoreDifference> diffs = SubjectiveUtils .compareSubjectiveFiles(getFile(), compareFile); if (null == diffs) { JOptionPane.showMessageDialog(null, "Challenge descriptors are different, comparison failed", "Error", JOptionPane.ERROR_MESSAGE); } else if (!diffs.isEmpty()) { showDifferencesDialog(diffs); } else { JOptionPane.showMessageDialog(null, "No differences found", "No Differences", JOptionPane.INFORMATION_MESSAGE); } } catch (final SAXParseException spe) { final String errorMessage = String.format( "Error parsing file line: %d column: %d%n Message: %s%n This may be caused by using the wrong version of the software attempting to parse a file that is not subjective data.", spe.getLineNumber(), spe.getColumnNumber(), spe.getMessage()); LOGGER.error(errorMessage, spe); JOptionPane.showMessageDialog(null, errorMessage, "Error", JOptionPane.ERROR_MESSAGE); } catch (final SAXException se) { final String errorMessage = "The subjective scores file was found to be invalid, check that you are parsing a subjective scores file and not something else"; LOGGER.error(errorMessage, se); JOptionPane.showMessageDialog(null, errorMessage, "Error", JOptionPane.ERROR_MESSAGE); } catch (final IOException e) { LOGGER.error("Error reading compare file", e); JOptionPane.showMessageDialog(null, "Error reading compare file: " + e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } } }); tabbedPane = new JTabbedPane(); getContentPane().add(tabbedPane, BorderLayout.CENTER); addWindowListener(new WindowAdapter() { @Override public void windowClosing(final WindowEvent e) { quit(); } }); pack(); }