Example usage for javax.swing JOptionPane ERROR_MESSAGE

List of usage examples for javax.swing JOptionPane ERROR_MESSAGE

Introduction

In this page you can find the example usage for javax.swing JOptionPane ERROR_MESSAGE.

Prototype

int ERROR_MESSAGE

To view the source code for javax.swing JOptionPane ERROR_MESSAGE.

Click Source Link

Document

Used for error messages.

Usage

From source file:net.sf.jabref.external.ExternalFilePanel.java

private void pushXMP(final String fieldName, final FieldEditor editor) {

    JabRefExecutorService.INSTANCE.execute(new Runnable() {

        @Override/*ww  w .ja v  a2  s . c  om*/
        public void run() {

            output(Localization.lang("Looking for pdf..."));

            // Find the default directory for this field type, if any:
            String[] dirs = metaData.getFileDirectory(fieldName);
            File file = null;
            if (dirs.length > 0) {
                File tmp = FileUtil.expandFilename(editor.getText(), dirs);
                if (tmp != null) {
                    file = tmp;
                }
            }

            if (file == null) {
                file = new File(editor.getText());
            }

            final File finalFile = file;

            output(Localization.lang("Writing XMP to '%0'...", finalFile.getName()));
            try {
                XMPUtil.writeXMP(finalFile, getEntry(), getDatabase());
                output(Localization.lang("Wrote XMP to '%0'.", finalFile.getName()));
            } catch (IOException e) {
                JOptionPane.showMessageDialog(editor.getParent(),
                        Localization.lang("Error writing XMP to file: %0", e.getLocalizedMessage()),
                        Localization.lang("Writing XMP"), JOptionPane.ERROR_MESSAGE);
                // String above and below
                LOGGER.info("Error writing XMP to file: " + finalFile.getAbsolutePath(), e);
                output(Localization.lang("Error writing XMP to file: %0", finalFile.getName()));

            } catch (TransformerException e) {
                JOptionPane.showMessageDialog(editor.getParent(),
                        Localization.lang("Error converting BibTeX to XMP: %0", e.getLocalizedMessage()),
                        Localization.lang("Writing XMP"), JOptionPane.ERROR_MESSAGE);
                LOGGER.info("Error while converting BibEntry to XMP " + finalFile.getAbsolutePath(), e);
                output(Localization.lang("Error converting XMP to '%0'...", finalFile.getName()));
            }
        }
    });
}

From source file:net.sf.housekeeper.swing.MainFrame.java

/**
 * Shows a dialog which informs the user that saving was not succesful.
 *  /* w  w w.  java 2 s  . c o m*/
 */
private void showSavingErrorDialog() {
    final String message = LocalisationManager.INSTANCE.getText("gui.mainFrame.saveError");
    final String error = LocalisationManager.INSTANCE.getText("gui.error");
    JOptionPane.showMessageDialog(view, message, error, JOptionPane.ERROR_MESSAGE);
}

From source file:Display.java

@SuppressWarnings("unchecked")
Display() {/*from www  . jav  a  2  s .c om*/
    super(Reference.NAME);
    cardLayout = new CardLayout();
    panel.setLayout(cardLayout);
    final int java7Update = Utils.Validators.java7Update.check();
    final int java8Update = Utils.Validators.java8Update.check();
    try {
        URL host = new URL(Reference.PROTOCOL, Reference.SOURCE_HOST, Reference.PORT, Reference.JSON_ARRAY);
        JSONParser parser = new JSONParser();
        Object json = parser.parse(new URLReader(host));
        final JSONArray array = (JSONArray) json;
        JSONObject nameObject1 = (JSONObject) array.get(0);
        XPackInstaller.selected_url = nameObject1.get("url").toString();
        XPackInstaller.javaVersion = Integer.parseInt(nameObject1.get("version").toString());
        XPackInstaller.profile = nameObject1.get("profile").toString();
        XPackInstaller.canAcceptOptional = Boolean
                .parseBoolean(nameObject1.get("canAcceptOptional").toString());
        if (!XPackInstaller.canAcceptOptional) {
            checkOptifine.setEnabled(false);
            checkOptifine.setSelected(false);
            zainstalujMoCreaturesCheckBox.setEnabled(false);
            zainstalujMoCreaturesCheckBox.setSelected(false);
            optionalText.setEnabled(false);
        } else {
            checkOptifine.setEnabled(true);
            zainstalujMoCreaturesCheckBox.setEnabled(true);
            optionalText.setEnabled(true);
        }
        for (Object anArray : array) {
            comboBox1.addItem(new JSONObject((JSONObject) anArray).get("name"));
        }
        comboBox1.addActionListener(e -> {
            int i = 0;
            while (true) {
                JSONObject nameObject = (JSONObject) array.get(i);
                String name1 = nameObject.get("name").toString();
                if (name1 == comboBox1.getSelectedItem()) {
                    XPackInstaller.canAcceptOptional = Boolean
                            .parseBoolean(nameObject.get("canAcceptOptional").toString());
                    XPackInstaller.selected_url = nameObject.get("url").toString();
                    XPackInstaller.javaVersion = Integer.parseInt(nameObject.get("version").toString());
                    XPackInstaller.profile = nameObject.get("profile").toString();
                    if (!XPackInstaller.canAcceptOptional) {
                        checkOptifine.setEnabled(false);
                        checkOptifine.setSelected(false);
                        zainstalujMoCreaturesCheckBox.setEnabled(false);
                        zainstalujMoCreaturesCheckBox.setSelected(false);
                        optionalText.setEnabled(false);
                    } else {
                        checkOptifine.setEnabled(true);
                        zainstalujMoCreaturesCheckBox.setEnabled(true);
                        optionalText.setEnabled(true);
                    }
                    break;
                }
                i++;
            }
            int javaStatus;
            if (XPackInstaller.javaVersion == 8) {
                javaStatus = java8Update;
            } else {
                javaStatus = java7Update;
            }
            if (javaStatus == 0) {
                javaversion.setText("TAK");
                javaversion.setForeground(Reference.COLOR_DARK_GREEN);
            } else if (javaStatus == 1) {
                javaversion.setText("NIE");
                javaversion.setForeground(Reference.COLOR_DARK_ORANGE);
            } else if (javaStatus == 2) {
                if (XPackInstaller.javaVersion == 8) {
                    javaversion.setText("Nie posiadasz JRE8 w wersji 25 lub nowszej!");
                } else {
                    javaversion.setText("Nie posiadasz najnowszej wersji JRE7!");
                }
                javaversion.setForeground(Color.RED);
            }
            if (osarch.getText().equals("TAK") && Ram.getText().equals("TAK")
                    && javaarch.getText().equals("TAK")
                    && (javaversion.getText().equals("TAK") || javaversion.getText().equals("NIE"))) {
                XPackInstaller.canGoForward = true;
                button2.setText("Dalej");
            } else {
                XPackInstaller.canGoForward = false;
                button2.setText("Anuluj");
            }
        });
    } catch (FileNotFoundException | ParseException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
        JOptionPane.showMessageDialog(panel, "Brak poczenia z Internetem!", "Bd",
                JOptionPane.ERROR_MESSAGE);
        System.exit(0);
    }

    pobierzOryginalnyLauncherMCCheckBox.addActionListener(e -> {
        if (pobierzOryginalnyLauncherMCCheckBox.isSelected()) {
            PathLauncherLabel.setEnabled(true);
            textField1.setEnabled(true);
            button3.setEnabled(true);
            XPackInstaller.installLauncher = true;
            labelLauncher.setEnabled(true);
            progressBar3.setEnabled(true);
        } else {
            PathLauncherLabel.setEnabled(false);
            textField1.setEnabled(false);
            button3.setEnabled(false);
            XPackInstaller.installLauncher = false;
            labelLauncher.setEnabled(false);
            progressBar3.setEnabled(false);
        }
    });
    button3.addActionListener(e -> {
        JFileChooser chooser = new JFileChooser(System.getProperty("user.home"));
        chooser.setApproveButtonText("Wybierz");
        chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
        chooser.setMultiSelectionEnabled(false);
        chooser.setDialogTitle("Wybierz ciek");
        int returnValue = chooser.showOpenDialog(getContentPane());
        if (returnValue == JFileChooser.APPROVE_OPTION) {
            try {
                XPackInstaller.launcher_path = chooser.getSelectedFile().getCanonicalPath();
            } catch (IOException x) {
                x.printStackTrace();
            }
            textField1.setText(XPackInstaller.launcher_path);
        }
    });
    slider1.setMaximum(Utils.Utils.humanReadableRAM() - 2);
    slider1.addChangeListener(e -> XPackInstaller.allocatedRAM = slider1.getValue());
    button1.addActionListener(e -> {
        if (pobierzOryginalnyLauncherMCCheckBox.isSelected()) {
            File launcher = new File(XPackInstaller.launcher_path + File.separator + "Minecraft.exe");
            if (textField1.getText().equals("")) {
                JOptionPane.showMessageDialog(panel, "Nie wybrae cieki instalacji Launcher'a!",
                        "Bd", JOptionPane.ERROR_MESSAGE);
            } else if (launcher.exists()) {
                JOptionPane.showMessageDialog(panel,
                        "W podanym katalogu istanieje ju plik o nazwie 'Minecraft.exe'!", "Bad",
                        JOptionPane.ERROR_MESSAGE);
            } else {
                cardLayout.next(panel);
            }
        } else {
            cardLayout.next(panel);
            if (osarch.getText().equals("NIE") && Ram.getText().equals("TAK")
                    && javaarch.getText().equals("NIE")
                    && (javaversion.getText().equals("TAK") || javaversion.getText().equals("NIE"))) {
                XPackInstaller.canGoForward = false;
                button2.setText("Anuluj");
                JOptionPane.showMessageDialog(gui,
                        "Prosimy sprawdzi\u0107 czy na komputerze nie ma zainstalowanych dw\u00f3ch \u015brodowisk Java: w wersji 32-bitowej i 64-bitowej.\nJe\u015bli zainstalowane s\u0105 obie wersje prosimy o odinstalowanie wersji 32-bitowej. To rozwi\u0105\u017ce problem.",
                        "B\u0142\u0105d konfiguracji Javy", JOptionPane.ERROR_MESSAGE);
            }
        }
    });

    if (Utils.Validators.systemArchitecture.check()) {
        osarch.setText("TAK");
        osarch.setForeground(Reference.COLOR_DARK_GREEN);
    } else {
        osarch.setText("NIE");
        osarch.setForeground(Color.RED);
    }
    if (Utils.Validators.ramAmount.check()) {
        Ram.setText("TAK");
        Ram.setForeground(Reference.COLOR_DARK_GREEN);
    } else {
        Ram.setText("NIE");
        Ram.setForeground(Color.RED);
    }
    if (Utils.Validators.javaArchitecture.check()) {
        javaarch.setText("TAK");
        javaarch.setForeground(Reference.COLOR_DARK_GREEN);
    } else {
        javaarch.setText("NIE");
        javaarch.setForeground(Color.RED);
    }
    int javaStatus;

    if (XPackInstaller.javaVersion == 8) {
        javaStatus = java8Update;
    } else {
        javaStatus = java7Update;
    }

    if (javaStatus == 0) {
        javaversion.setText("TAK");
        javaversion.setForeground(Reference.COLOR_DARK_GREEN);
    } else if (javaStatus == 1) {
        javaversion.setText("NIE");
        javaversion.setForeground(Reference.COLOR_DARK_ORANGE);
    } else if (javaStatus == 2) {
        javaversion.setText("Nie posiadasz najnowszej wersji JRE!");
        javaversion.setForeground(Color.RED);
    }
    if (osarch.getText().equals("TAK") && Ram.getText().equals("TAK") && javaarch.getText().equals("TAK")
            && (javaversion.getText().equals("TAK") || javaversion.getText().equals("NIE"))) {
        XPackInstaller.canGoForward = true;
        button2.setText("Dalej");
    } else {
        XPackInstaller.canGoForward = false;
        button2.setText("Anuluj");
    }
    button2.addActionListener(e -> {
        if (XPackInstaller.canGoForward) {
            cardLayout.next(panel);
        } else {
            System.exit(1);
        }
    });
    wsteczButton.addActionListener(e -> cardLayout.previous(panel));
    try {
        editorPane1.setPage("http://xpack.pl/licencja.html");
    } catch (IOException e) {
        e.printStackTrace();
        JOptionPane.showMessageDialog(panel, "Brak poczenia z Internetem!", "Bd",
                JOptionPane.ERROR_MESSAGE);
        System.exit(0);
    }
    licenseC.addActionListener(e -> {
        if (licenseC.isSelected()) {
            dalejButton.setEnabled(true);
        } else {
            dalejButton.setEnabled(false);
        }
    });
    try {
        File mainDir = new File(System.getenv("appdata") + File.separator + "XPackInstaller");
        if (mainDir.exists()) {
            FileUtils.deleteDirectory(mainDir);
            if (!mainDir.mkdir()) {
                JOptionPane.showMessageDialog(gui,
                        "Nie udao si utworzy katalogu, prosimy sprbowa ponownie!", "Bd",
                        JOptionPane.ERROR_MESSAGE);
                System.out.println("Nie udao si utworzy katalogu!");
                System.exit(1);
            }
        } else {
            if (!mainDir.mkdir()) {
                JOptionPane.showMessageDialog(gui,
                        "Nie udao si utworzy katalogu, prosimy sprbowa ponownie!", "Bd",
                        JOptionPane.ERROR_MESSAGE);
                System.out.println("Nie udao si utworzy katalogu!");
                System.exit(1);
            }
        }
        File optionalDir = new File(mainDir.getAbsolutePath() + File.separator + "OptionalMods");
        if (!optionalDir.mkdir()) {
            JOptionPane.showMessageDialog(gui,
                    "Nie udao si utworzy katalogu, prosimy sprbowa ponownie!", "Bd",
                    JOptionPane.ERROR_MESSAGE);
            System.out.println("Nie udao si utworzy katalogu!");
            System.exit(1);
        }
        dalejButton.addActionListener(e -> {
            cardLayout.next(panel);
            try {
                progressBar1.setValue(0);
                if (checkOptifine.isSelected() && zainstalujMoCreaturesCheckBox.isSelected()) {
                    DownloadTask task2 = new DownloadTask(gui, "mod", Reference.downloadOptifine,
                            optionalDir.getAbsolutePath());
                    task2.addPropertyChangeListener(evt -> {
                        if (evt.getPropertyName().equals("progress")) {
                            labelmodpack.setText("Pobieranie Optifine HD w toku...");
                            if (task2.isDone()) {
                                task3();
                            }
                            optifineProgress = (Integer) evt.getNewValue();
                            progressBar1.setValue(optifineProgress);
                        }
                    });
                    task2.execute();
                } else if (checkOptifine.isSelected()) {
                    DownloadTask task2 = new DownloadTask(gui, "mod", Reference.downloadOptifine,
                            optionalDir.getAbsolutePath());
                    task2.addPropertyChangeListener(evt -> {
                        if (evt.getPropertyName().equals("progress")) {
                            labelmodpack.setText("Pobieranie Optifine HD w toku...");
                            if (task2.isDone()) {
                                task();
                            }
                            optifineProgress = (Integer) evt.getNewValue();
                            progressBar1.setValue(optifineProgress);
                        }
                    });
                    task2.execute();
                } else if (zainstalujMoCreaturesCheckBox.isSelected()) {
                    task3();
                } else {
                    task();
                }
            } catch (Exception exx) {
                exx.printStackTrace();
            }
        });
    } catch (IOException e) {
        e.printStackTrace();
    }

    final JScrollBar bar = scrollPane1.getVerticalScrollBar();
    bar.addMouseListener(new MouseListener() {
        @Override
        public void mouseClicked(MouseEvent e) {
            int extent = bar.getModel().getExtent();
            int total = extent + bar.getValue();
            int max = bar.getMaximum();
            if (total == max) {
                licenseC.setEnabled(true);
            }
        }

        @Override
        public void mousePressed(MouseEvent e) {
        }

        @Override
        public void mouseReleased(MouseEvent e) {
            int extent = bar.getModel().getExtent();
            int total = extent + bar.getValue();
            int max = bar.getMaximum();
            if (total == max) {
                licenseC.setEnabled(true);
            }
        }

        @Override
        public void mouseEntered(MouseEvent e) {
        }

        @Override
        public void mouseExited(MouseEvent e) {
        }
    });
    bar.addMouseWheelListener(e -> {
        int extent = bar.getModel().getExtent();
        int total = extent + bar.getValue();
        int max = bar.getMaximum();
        if (total == max) {
            licenseC.setEnabled(true);
        }
    });
    scrollPane1.setWheelScrollingEnabled(true);
    scrollPane1.addMouseWheelListener(e -> {
        int extent = bar.getModel().getExtent();
        int total = extent + bar.getValue();
        int max = bar.getMaximum();
        if (total == max) {
            licenseC.setEnabled(true);
        }
    });
    panel.add(panel3);
    panel.add(panel1);
    panel.add(panel2);
    panel.add(panel4);
    add(panel);
}

From source file:com.simplexrepaginator.RepaginateFrame.java

protected JButton createRepaginateButton() {
    JButton b = new JButton("<html><center>Click to<br>repaginate", REPAGINATE_ICON);

    b.setHorizontalTextPosition(SwingConstants.LEFT);
    b.setIconTextGap(25);/*from www .  j  av a2  s .co  m*/

    b.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            try {
                int[] documentsPages = repaginator.repaginate();
                JOptionPane.showMessageDialog(RepaginateFrame.this,
                        "Repaginated " + documentsPages[0] + " documents with " + documentsPages[1] + " pages.",
                        "Repagination Complete", JOptionPane.INFORMATION_MESSAGE);
            } catch (Exception ex) {
                ex.printStackTrace();
                JOptionPane.showMessageDialog(RepaginateFrame.this, ex.toString(), "Error During Repagination",
                        JOptionPane.ERROR_MESSAGE);
            }
        }
    });

    return b;
}

From source file:de.tbuchloh.kiskis.KisKis.java

private static void initThreadMonitors() {
    final UncaughtExceptionHandler eh = new UncaughtExceptionHandler() {

        @Override// w  w w.ja v  a  2s  . c om
        public void uncaughtException(Thread t, Throwable e) {
            LOG.debug("Uncaught Exception occurred! e=" + e.getMessage());
            try {
                MessageBox.showException(e);
            } catch (final Throwable throwable) {
                LOG.error(
                        "Uncaught Exception could not be displayed due to another exception! anotherThrowable="
                                + throwable + ", rootCause=" + e,
                        throwable);
            }
        }
    };
    Thread.setDefaultUncaughtExceptionHandler(eh);

    final ThreadDeadlockDetector detector = new ThreadDeadlockDetector();
    detector.addListener(new DefaultDeadlockListener());
    detector.addListener(new DefaultDeadlockListener() {

        private volatile boolean fired = false;

        @Override
        public void deadlockDetected(Thread[] deadlockedThreads) {
            if (fired) {
                return;
            }
            fired = true;

            final File file = new File(System.getProperty("java.io.tmpdir"), "kiskis-deadlock.txt");
            final String msg = format(
                    "Threads were blocked!\nYou need to restart the application.\nPlease mail file \"%2$s\" as bug.\nthreads=%1$s",
                    Arrays.toString(deadlockedThreads), file.getAbsolutePath());
            JOptionPane.showMessageDialog(null, msg, "Deadlock detected!", JOptionPane.ERROR_MESSAGE);
        }
    });
}

From source file:com.sittinglittleduck.DirBuster.CheckForUpdates.java

private void showErrorMessage(String message) {
    if (informUser) {
        JOptionPane.showMessageDialog(manager.gui, message, "Error", JOptionPane.ERROR_MESSAGE);
    }//from w w w.  java2 s.c o m
}

From source file:dialog.DialogFunctionUser.java

private void actionAddUser() {
    if (!isValidData()) {
        return;/*  ww w.j a  v  a 2s  .  com*/
    }
    if (isExistUsername(tfUsername.getText())) {
        JOptionPane.showMessageDialog(null, "Username  tn ti", "Error", JOptionPane.ERROR_MESSAGE);
        return;
    }
    String username = tfUsername.getText();
    String fullname = tfFullname.getText();
    String password = new String(tfPassword.getPassword());
    password = LibraryString.md5(password);
    int role = cbRole.getSelectedIndex();
    User objUser;
    if (mAvatar != null) {
        objUser = new User(UUID.randomUUID().toString(), username, password, fullname, role,
                new Date(System.currentTimeMillis()), mAvatar.getPath());
        String fileName = FilenameUtils.getBaseName(mAvatar.getName()) + "-" + System.nanoTime() + "."
                + FilenameUtils.getExtension(mAvatar.getName());
        Path source = Paths.get(mAvatar.toURI());
        Path destination = Paths.get("files/" + fileName);
        try {
            Files.copy(source, destination, StandardCopyOption.REPLACE_EXISTING);
        } catch (IOException ex) {
            Logger.getLogger(DialogFunctionRoom.class.getName()).log(Level.SEVERE, null, ex);
        }
    } else {
        objUser = new User(UUID.randomUUID().toString(), username, password, fullname, role,
                new Date(System.currentTimeMillis()), "");
    }
    if (mControllerUser.addItem(objUser)) {
        ImageIcon icon = new ImageIcon(getClass().getResource("/images/ic_success.png"));
        JOptionPane.showMessageDialog(this.getParent(), "Thm thnh cng", "Success",
                JOptionPane.INFORMATION_MESSAGE, icon);
    } else {
        JOptionPane.showMessageDialog(this.getParent(), "Thm tht bi", "Fail",
                JOptionPane.ERROR_MESSAGE);
    }
    this.dispose();
}

From source file:edu.harvard.mcz.imagecapture.jobs.JobRecheckForTemplates.java

private List<ICImage> getFileList() {
    List<ICImage> files = new ArrayList<ICImage>();
    if (scan != SCAN_ALL) {
        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;/*from  w ww. java  2s . c  om*/
        // 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 database 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 (!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();
                    ICImage pattern = new ICImage();
                    pattern.setPath(pathToCheck);
                    pattern.setTemplateId(PositionTemplate.TEMPLATE_NO_COMPONENT_PARTS);
                    files = ils.findByExample(pattern);
                    if (files != null) {
                        log.debug(files.size());
                    }
                }
            }
        }
    } else {
        try {
            // retrieve a list of all image records with no template
            ICImageLifeCycle ils = new ICImageLifeCycle();
            files = ils.findNotDrawerNoTemplateImages();
            if (files != null) {
                log.debug(files.size());
            }
        } catch (HibernateException e) {
            log.error(e.getMessage());
            runStatus = RunStatus.STATUS_FAILED;
            String message = "Error loading the list of images with no templates. " + e.getMessage();
            JOptionPane.showMessageDialog(Singleton.getSingletonInstance().getMainFrame(), message,
                    "Error loading image records.", JOptionPane.YES_NO_OPTION);
        }
    }

    log.debug("Found " + files.size() + " Image files without templates in directory to check.");

    return files;
}

From source file:fr.isen.browser5.Util.UrlLoader.java

public void parseResponse() {
    doc = null;//from w  w w  .  j a v a 2 s  .c  om
    try {
        System.out.println("Response url: " + pageUrl);
        tabView.syncTabHistory(pageUrl.toString());
        tabView.removeAll();
        if (tabView.getCurrentFrame().getTabPane().getSelectedIndex() == tabView.getCurrentTabIndex()) {
            tabView.getCurrentFrame().setUrl(pageUrl.toString());
        }
        tabView.setUrl(pageUrl);
        checkHtmlCharset();
        tabView.setDoc(doc);
        setTabTitleFavicon();
        tabView.getCurrentScrollPane().getViewport().setBackground(Color.WHITE);
        tabView.getDevView().clear();
        elementVisitor = new ElementVisitor(tabView);
        doc.body().traverse(elementVisitor);
        getScripts();
        tabView.removeAll();
        movePanel();
        tabView.getDevView().load(tabView);
        tabView.getDevView().executeScripts(script);
        tabView.revalidate();
        tabView.repaint();
    } catch (IOException e) {
        e.printStackTrace();
        JOptionPane.showMessageDialog(null, e.getMessage(), e.getClass().getSimpleName(),
                JOptionPane.ERROR_MESSAGE);
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:org.pgptool.gui.app.EntryPoint.java

private static void reportAppInitFailureMessageToUser(Throwable t) {
    String versionInfo = NewVersionCheckerGitHubImpl.getVerisonsInfo();
    String msg = ConsoleExceptionUtils.getAllMessages(t);
    msg += "\r\n" + versionInfo;
    UiUtils.messageBox(null, msg, "PGP Tool startup failed" + versionInfo, JOptionPane.ERROR_MESSAGE);
}