Example usage for javax.swing JOptionPane WARNING_MESSAGE

List of usage examples for javax.swing JOptionPane WARNING_MESSAGE

Introduction

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

Prototype

int WARNING_MESSAGE

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

Click Source Link

Document

Used for warning messages.

Usage

From source file:com.akman.excel.view.frmExportExcel.java

private void btnExportDataActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnExportDataActionPerformed
    if (txtPath.getText().equals("")) {
        JOptionPane.showMessageDialog(null, "Kindly select the template file", "ERROR",
                JOptionPane.WARNING_MESSAGE);
        return;//from ww w.  java  2 s  .  c o  m
    }

    Invoices = TestFactory.generateCollection(fileName);

    CURDInvoice.Delete();

    for (Object Inv : Invoices) {

        CURDInvoice.Save((Invoice) Inv);
    }

    JOptionPane.showMessageDialog(null, "Sucessfully generated reports. ");
}

From source file:be.ac.ua.comp.scarletnebula.gui.windows.GUI.java

public void terminateSelectedServers() {
    final Collection<Server> servers = serverList.getSelectedServers();

    if (servers.isEmpty()) {
        return;/*from  w  w  w  . j  av a  2s  .  c  om*/
    }

    final String deleteMessage = "You are about to terminate " + servers.size() + " server(s). \n"
            + "Terminating a server will permanently destroy the server. This operation cannot be undone.\n\n"
            + "Do you wish to proceed?";

    final String deleteTitle = "Terminate " + servers.size() + " server(s)";
    final String buttonString = deleteTitle;
    final int result = JOptionPane.showOptionDialog(this, deleteMessage, deleteTitle,
            JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE, null,
            Arrays.asList(buttonString, "Cancel").toArray(), "Cancel");

    if (result != JOptionPane.OK_OPTION) {
        return;
    }

    (new SwingWorkerWithThrobber<Exception, Object>(
            newThrobber("Terminating server" + ((servers.size() > 1) ? "s" : ""))) {
        @Override
        protected Exception doInBackground() throws Exception {
            for (final Server server : servers) {
                try {
                    server.terminate();
                    server.refreshUntilServerHasState(VmState.TERMINATED);
                } catch (final Exception e) {
                    return e;
                }
            }
            return null;
        }

        @Override
        public void done() {
            try {
                final Exception result = get();

                if (result != null) {
                    log.error(result);
                    error(result);
                }
            } catch (final Exception ignore) {
            }
        }
    }).execute();

}

From source file:de.quadrillenschule.azocamsyncd.gui.ConfigurationWizardJFrame.java

private void autoruninstalljButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_autoruninstalljButton1ActionPerformed
    boolean success = false;
    JFileChooser jfc = new JFileChooser();
    jfc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    jfc.setApproveButtonText("Prepare card...");
    File startFile = new File(System.getProperty("user.dir")); //Get the current directory

    // Find System Root
    while (!FileSystemView.getFileSystemView().isFileSystemRoot(startFile)) {
        startFile = startFile.getParentFile();
    }//from  ww  w  .  j av a2 s . c  o m

    jfc.setCurrentDirectory(startFile);
    int origDriveChooserRetVal = jfc.showDialog(rootPane, "Open");
    if (origDriveChooserRetVal == JFileChooser.APPROVE_OPTION) {
        try {
            File myfile = new File(jfc.getSelectedFile().getAbsolutePath(), "autorun.sh");
            myfile.createNewFile();
            FileOutputStream fos;
            try {
                fos = new FileOutputStream(myfile);
                IOUtils.copy(getClass().getResourceAsStream(
                        "/de/quadrillenschule/azocamsyncd/ftpservice/res/autorun.sh"), fos);
                fos.close();
                success = true;
            } catch (FileNotFoundException ex) {
                Logger.getLogger(ConfigurationWizardJFrame.class.getName()).log(Level.SEVERE, null, ex);
            }

        } catch (IOException ex) {
            Logger.getLogger(ConfigurationWizardJFrame.class.getName()).log(Level.SEVERE, null, ex);
        }

    }
    if (!success) {
        JOptionPane.showMessageDialog(rootPane,
                "The WiFi is SD card could not be written to. Please check if you selected the right card and it is not write-protected.",
                "SD card could not be prepared", JOptionPane.WARNING_MESSAGE);
    } else {
        JOptionPane.showMessageDialog(rootPane,
                "The WiFi SD card is prepared for operating an FTP and Telnet server.", "Success!",
                JOptionPane.INFORMATION_MESSAGE);
        step0jCheckBox.setSelected(true);
        step0jCheckBox.setText("Done");
        updateSelectedPanel(1);
    }
}

From source file:io.github.jeddict.jpa.modeler.properties.convert.ConverterPanel.java

private boolean validateField() {
    if (converter_EditorPane.getText().trim().length() <= 0) {
        JOptionPane.showMessageDialog(this, "Converter can't be empty", "Invalid Value",
                javax.swing.JOptionPane.WARNING_MESSAGE);
        return false;
    }/*from   www . j  a v  a2 s.c om*/
    if (attribute_EditorPane.getText().trim().length() <= 0) {
        JOptionPane.showMessageDialog(this, "Attribute type can't be empty", "Invalid Value",
                javax.swing.JOptionPane.WARNING_MESSAGE);
        return false;
    }
    if (field_EditorPane.getText().trim().length() <= 0) {
        JOptionPane.showMessageDialog(this, "Field type can't be empty", "Invalid Value",
                javax.swing.JOptionPane.WARNING_MESSAGE);
        return false;
    }
    return true;
}

From source file:ca.canuckcoding.wosqi.FeedViewer.java

private void install() {
    int tab = jTabbedPane2.getSelectedIndex();
    ArrayList<PackageEntry> pkgList = getInstallList(selected[tab]);
    String msg = "<html><body width=\"300px\">" + MessageFormat
            .format(bundle.getString("DEPENDANCY_INSTALL_WARNING"), new Object[] { selected[tab].name }) + "\n";
    ArrayList installList = new ArrayList();
    for (int i = 0; i < pkgList.size(); i++) {
        PackageEntry curr = pkgList.get(i);
        if (!pkgMgr.isInstalled(curr)) {
            if (!curr.id.equals(selected[tab].id)) {
                msg += "\n" + curr.name;
            }/*from w ww  . j  a v  a  2 s  . c o m*/
            installList.add(curr.getDownloadUrl());
        }
    }
    if (installList.size() > 1) {
        if (JOptionPane.showConfirmDialog(rootPane, msg, bundle.getString("WARNING"),
                JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE) == JOptionPane.OK_OPTION) {
            doInstall(tab, installList);
        }
    } else {
        doInstall(tab, installList);
    }
}

From source file:localization.SplitterUI.java

private void openFolderActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_openFolderActionPerformed
    // TODO add your handling code here:
    String folderpath = filepath.getText();
    File fPath = new File(folderpath);
    if (folderpath.length() > 0) {
        File folder = null;/*from  w  w w .j a  v  a 2s  .c om*/
        if (folderpath.endsWith(".lpu") && !fPath.isDirectory()) {
            folder = new File(folderpath.substring(0, folderpath.lastIndexOf("\\")));
        } else if (folderpath.endsWith(".zip") && !fPath.isDirectory()) {
            File zFile = new File(folderpath.substring(0, folderpath.lastIndexOf(".")));
            if (!zFile.exists()) {
                JOptionPane.showMessageDialog(this,
                        "Cannot find the unzip folder, please run it with zip file first.", "Folder Issue",
                        JOptionPane.WARNING_MESSAGE, null);
                return;
            }
            folder = new File(folderpath.substring(0, folderpath.lastIndexOf(".")));
        } else if (fPath.isDirectory()) {
            folder = fPath;
        }
        if (Desktop.isDesktopSupported()) {
            try {
                Desktop.getDesktop().open(folder);
            } catch (IOException ex) {
                Logger.getLogger(SplitterUI.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    } else {
        String home = System.getProperty("user.home") + "\\Desktop";
        File folder = new File(home);
        if (Desktop.isDesktopSupported()) {
            try {
                Desktop.getDesktop().open(folder);
            } catch (IOException ex) {
                Logger.getLogger(SplitterUI.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    }
}

From source file:UserInterface.PatientRole.ManageMyVitalSignsAndFitnessRecordJPanel.java

private void sendToMyDoctorJButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_sendToMyDoctorJButtonActionPerformed
    //         TODO add your handling code here:
    int selectedRow = viewVitalSignsJTable1.getSelectedRow();
    if (selectedRow < 0) {
        JOptionPane.showMessageDialog(null, "Please select a row from the table first to view detail",
                "Warning", JOptionPane.WARNING_MESSAGE);

    } else {/* w  ww  .  j  ava2s .com*/

        UserAccount doctor = (UserAccount) patient.getMydoctor();
        PatientDoctorWorkRequest request = new PatientDoctorWorkRequest();
        request.setDoctor(doctor);
        request.setPatientName(userAccount.getName());
        request.setDate();
        request.setVsNormalorNot("Abnormal");
        request.setFtNormalorNot("Need More Excercise");

        Organization org = null;
        for (Organization organization : enterprise.getOrganizationDirectory().getOrganizationList()) {
            if (organization instanceof DoctorOrganization) {
                org = organization;
                break;
            }
        }

        if (org != null) {
            org.getWorkQueue().getWorkRequestList().add(request);
            userAccount.getWorkQueue().getWorkRequestList().add(request);
            doctor.getWorkQueue().getWorkRequestList().add(request);
            JOptionPane.showMessageDialog(null, "Success! ");
        }

    }
}

From source file:UserInterface.EmployeeViewArea.ViewResolvedIssuesStatisticsJPanel.java

private void btnSaveImageActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSaveImageActionPerformed
    // TODO add your handling code here:
    // JFreeChart pieChart = createPieChart(createPieDataset());
    try {//w ww  .  j a  va  2s .  c om
        String fileName = String.valueOf(count);
        fileName += imageName[rand.nextInt(imageName.length)];
        saveToFile(chart, workingDir + "\\src\\Images" + "\\" + fileName + "plot.jpg", 500, 300, 100);
        count++;
        JOptionPane.showMessageDialog(null, "Image saved successfully", "Warning", JOptionPane.WARNING_MESSAGE);

    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:br.org.acessobrasil.ases.ferramentas_de_reparo.vista.preenchedor_formulario.PanelPreenchedorFormulario.java

/**
 * Avalia a URL//w w  w . ja va  2 s.c o m
 * 
 * @param url
 *            endereo
 */
public void avaliaUrl(String url) {
    PegarPaginaWEB ppw = new PegarPaginaWEB();
    if (url != null) {
        arquivo = null;
        try {
            String codHtml = ppw.getContent(url);
            textAreaSourceCode.setText(codHtml);
            TxtBuffer.setContentOriginal(codHtml, "0");
            reavalia(codHtml);
            this.panelOriginal.avalia(codHtml);
            frameSilvinha.setUrlTextField(url);
        } catch (HttpException e1) {
            JOptionPane.showMessageDialog(this, TradPainelAvaliacao.AVISO_NAO_CONECTOU,
                    TradPainelAvaliacao.AVISO, JOptionPane.WARNING_MESSAGE);
        } catch (Exception e1) {
            JOptionPane.showMessageDialog(this, TradPainelAvaliacao.AVISO_VERIFIQUE_URL,
                    TradPainelAvaliacao.AVISO, JOptionPane.WARNING_MESSAGE);
        }
    }
}

From source file:canreg.client.gui.components.FastFilterInternalFrame.java

private void mouseClickHandler(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_mouseClickHandler
    DatabaseVariablesListElement dbvle = (DatabaseVariablesListElement) variableComboBox.getSelectedItem();
    if (dictionaryPopUp && (valueTextField.equals(evt.getSource()) || valueTextField2.equals(evt.getSource()))
            && dbvle.getVariableType().equalsIgnoreCase("dict")) {
        if (possibleValuesMap == null) {
            JOptionPane.showInternalMessageDialog(this,
                    java.util.ResourceBundle
                            .getBundle("canreg/client/gui/components/resources/FastFilterInternalFrame")
                            .getString("EMPTY_DICTIONARY"),
                    java.util.ResourceBundle
                            .getBundle("canreg/client/gui/components/resources/FastFilterInternalFrame")
                            .getString("WARNING"),
                    JOptionPane.WARNING_MESSAGE);
        } else {//from  w  w w. j a v  a 2 s  .  c  om
            // String oldValue = getValue().toString();
            // DictionaryEntry oldSelection = possibleValuesMap.get(oldValue);
            if (dictionaryElementChooser == null) {
                dictionaryElementChooser = new DictionaryElementChooser(this);
            } else {
                dictionaryElementChooser.setFirstPass();
            }
            dictionaryElementChooser.setDictionary(dictionary);
            // dictionaryElementChooser.setSelectedElement(oldSelection);

            // safe to cast as we check it in the first if-statement
            dictionaryElementChooserAssignedTextField = (JTextField) evt.getSource();
            CanRegClientView.showAndPositionInternalFrame(CanRegClientApp.getApplication().getDesktopPane(),
                    dictionaryElementChooser);
        }
    } else {
        // Do nothing
    }
    currentSelectionAdded = false;
}