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:imageprocessingproject.MainFrame.java

private void btnOpenFileActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOpenFileActionPerformed
    if (filechooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
        try {/*from w  ww  . j  ava2  s  .  c  o  m*/
            imageHandler.addImage(ImageIO.read(filechooser.getSelectedFile()));
            drawImage(imageHandler.getCurrentImage());
        } catch (NullPointerException ex) {
            //                open_tt_files(filechooser.getSelectedFile().toPath());
        } catch (IOException e) {
            JOptionPane.showMessageDialog(filechooser, "Not an image!", "Error", JOptionPane.WARNING_MESSAGE);
        }
    }
}

From source file:com.archivas.clienttools.arcmover.gui.panels.ProfilePanel.java

private void setFileList(final List<String> colsToDisplay, final List<ArcMoverFile> files,
        final boolean isVersionList, int badElementCnt, String dirPath) {
    fileListModel = new FileListTableModel(new ArrayList<String>(colsToDisplay));
    fileList.setModel(fileListModel);//from   w ww . j a  v  a  2 s .com
    fileList.setColumnCellRenderers();
    fileList.setListData(new ArrayList<ArcMoverFile>(files));
    if (isVersionList) {
        fileList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    } else {
        fileList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    }
    if (badElementCnt > 0) {
        String errMsg = String.format("Warning: omitted %d unsupported filename(s) in directory listing for %s",
                badElementCnt, profileModel.getSelectedProfile().decode(dirPath));
        LOG.log(Level.WARNING, errMsg);
        if (HCPMoverProperties.DISPLAY_WARNINGS_FOR_BAD_ELEMENTS_IN_DIRECTORY_LISTINGS.getAsBoolean()) {
            GUIHelper.showMessageDialog(this, errMsg, "", JOptionPane.WARNING_MESSAGE);
        }
    }
}

From source file:canreg.client.gui.dataentry.ImportView.java

/**
 *
 *///from  w  w w .  j  av a2 s. c om
@Action
public void cancelAction() {
    if (importTask != null) {
        if (JOptionPane.showInternalConfirmDialog(
                CanRegClientApp.getApplication().getMainFrame().getContentPane(),
                java.util.ResourceBundle.getBundle("canreg/client/gui/dataentry/resources/ImportView")
                        .getString("REALLY_CANCEL?"),
                java.util.ResourceBundle.getBundle("canreg/client/gui/dataentry/resources/ImportView")
                        .getString("PLEASE_CONFIRM."),
                JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
            importTask.cancel(true);
            JOptionPane.showInternalMessageDialog(
                    CanRegClientApp.getApplication().getMainFrame().getContentPane(),
                    java.util.ResourceBundle.getBundle("canreg/client/gui/dataentry/resources/ImportView")
                            .getString("IMPORT_OF_FILE_INTERUPTED"),
                    java.util.ResourceBundle.getBundle("canreg/client/gui/dataentry/resources/ImportView")
                            .getString("WARNING"),
                    JOptionPane.WARNING_MESSAGE);
            importTask = null;
            this.dispose();
        }
    } else {
        this.dispose();
    }
}

From source file:client.ui.FilePane.java

private void uploadFileButtonActionPerformed(ActionEvent evt) {//GEN-FIRST:event_uploadFileButtonActionPerformed
    UploadFileWindow uploadWindow = new UploadFileWindow(m_MainFrame);
    if (!uploadWindow.isConfirmed()) {
        //fileInfoTable.clearSelection();
        return;/*from  w  w  w .j  a  v a 2s.c  om*/
    }

    String filename = uploadWindow.getFileName();
    String filePath = uploadWindow.getFilePath();

    UploadFileResult result;
    try {
        result = m_Business.uploadFile(filename, filePath);
        switch (result) {
        case OK:
            JOptionPane.showMessageDialog(this, "?", "",
                    JOptionPane.INFORMATION_MESSAGE);
            break;
        case tooLarge:
            JOptionPane.showMessageDialog(this, "?", "",
                    JOptionPane.WARNING_MESSAGE);
            break;
        case unAuthorized:
            JOptionPane.showMessageDialog(this, "?", "",
                    JOptionPane.WARNING_MESSAGE);
            m_MainFrame.setVisible(false);
            LoginDialog loginDialog = new LoginDialog(m_MainFrame, m_Business);
            break;
        case wrong:
            JOptionPane.showMessageDialog(this, "??", "",
                    JOptionPane.WARNING_MESSAGE);
            break;
        default:
            JOptionPane.showMessageDialog(this, "", "", JOptionPane.ERROR_MESSAGE);
            break;

        }
    } catch (IOException e) {
        JOptionPane.showMessageDialog(this, "", "", JOptionPane.ERROR_MESSAGE);
    }
    getDirectory(currentID);
    //fileInfoTable.clearSelection();
}

From source file:userInterface.HospitalAdminRole.ManagePatientsJPanel.java

private void alertFamilyAdminBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_alertFamilyAdminBtnActionPerformed
    int selectedRow = vitalSignjTable.getSelectedRow();
    Person person = (Person) nameComboBox.getSelectedItem();
    String status = (String) vitalSignjTable.getValueAt(selectedRow, 6);
    for (Organization orgn : enterprise.getOrganizationList().getOrganizationList()) {
        if (orgn instanceof HouseholdOrg)
            for (UserAccount ua : orgn.getUserAccDir().getUserAccountList()) {
                if (ua.getPerson().getPersonName().equals(person.getPersonName())) {
                    account = ua;/*from   w w  w.j ava2 s  .c  o  m*/
                }
            }
    }
    if (selectedRow < 0) {
        JOptionPane.showMessageDialog(null, "Please select a row", "WARNING", JOptionPane.WARNING_MESSAGE);
        return;
    } else {
        if (!status.equals("Normal")) {
            Member member = (Member) vitalSignjTable.getValueAt(selectedRow, 0);
            String message = member.getMemberName();
            HosptoHouseWorkRequest request = new HosptoHouseWorkRequest();
            //HospitalWorkRequest request = (HospitalWorkRequest)alertRequestDetailsTable.getValueAt(selectedRow, 0);
            VitalSign vs = (VitalSign) vitalSignjTable.getValueAt(selectedRow, 1);
            if (!(vs.getAlertStatus().equals("Doc Reviewed") || vs.getAlertStatus().equals("sent to house"))) {
                JOptionPane.showMessageDialog(null, "Vital Sign not reviewed by doctor", "WARNING",
                        JOptionPane.WARNING_MESSAGE);
                return;
            }
            //            else if(vs.getAlertStatus().equals("sent to house")){
            //                JOptionPane.showMessageDialog(null, "Alert already sent to family admin", "WARNING", JOptionPane.WARNING_MESSAGE);
            //            }
            else {

                if (adminMsgTxt.getText().equals("")) {
                    JOptionPane.showMessageDialog(null, "Kindly enter a message", "Message",
                            JOptionPane.WARNING_MESSAGE);
                } else {
                    vs.setAlertStatus("sent to house");
                    populateTable(person);
                    Date reqDate = new Date();
                    request.setMessage(message);
                    request.setSender(userAccount);
                    request.setReceiver(account);
                    request.setRequestDate(reqDate);
                    request.setStatus("sent to member");
                    request.setAdminMessage(adminMsgTxt.getText());
                    Organization org = null;
                    for (Organization organization : enterprise.getOrganizationList().getOrganizationList()) {
                        if (organization instanceof HouseholdOrg) {
                            org = organization;
                            break;
                        }
                    }
                    if (org != null) {
                        userAccount.getWorkQueue().getWorkRequestList().add(request);
                        account.getWorkQueue().getWorkRequestList().add(request);
                    }
                    populateAlertFamilyTable();
                    JOptionPane.showMessageDialog(null, "Alert Sent to family admin", "Infomation",
                            JOptionPane.INFORMATION_MESSAGE);
                    //Person person = (Person)nameComboBox.getSelectedItem();
                    try {
                        String to = person.getEmail();
                        //String[] to = {"reshmi.padavala@gmail.com","naveensanaka@gmail.com"};
                        sendMailToCommunityMember(to, "Alert from Hospital Admin",
                                "Kindly check you account for alert details", "aedtest2015@gmail.com",
                                "Jaffa@123");
                    } catch (Exception ex) {
                        JOptionPane.showMessageDialog(null, "Could not send email", "Mail",
                                JOptionPane.WARNING_MESSAGE);
                    }
                }
            }
        } else {
            JOptionPane.showMessageDialog(null, "Vital Sign is normal.Alert not triggered", "MESSAGE",
                    JOptionPane.INFORMATION_MESSAGE);
        }
    }
}

From source file:br.org.acessobrasil.ases.ferramentas_de_reparo.vista.imagem.analise_geral.PanelAnaliseGeral.java

/**
 * Abre uma URL//from w ww  . j a  va 2  s  . co  m
 * 
 */
private void abreUrl() {
    String url;
    url = JOptionPane.showInputDialog(this, GERAL.DIGITE_ENDERECO, "http://");
    PegarPaginaWEB ppw = new PegarPaginaWEB();
    if (url != null) {
        // arquivo=null;
        try {
            String codHtml = ppw.getContent(url);
            // boxCode.setText(codHtml);
            // reavalia(codHtml);
            parentFrame.showPainelFerramentaDescricaoPArq(codHtml);
            EstadoSilvinha.setLinkAtual(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:net.sourceforge.entrainer.gui.EntrainerFX.java

private boolean showWavFileChooser() {
    JFileChooser wavChooser = getWavFileChooser();

    int val = wavChooser.showDialog(this, "Ok");
    if (val == JFileChooser.APPROVE_OPTION) {
        File wavFile = processFile(wavChooser.getSelectedFile());
        if (!isValidFile(wavFile)) {
            JOptionPane.showMessageDialog(this,
                    wavFile.getName() + " is not a valid WAV file name\n(it must end with a '.wav' extension)",
                    "Invalid WAV File Name", JOptionPane.WARNING_MESSAGE);
            return false;
        }/*from   www  .  j  av a  2 s. c  o  m*/
        control.setWavFile(wavFile);
        return true;
    }

    control.setWavFile(null);
    return false;
}

From source file:edu.ku.brc.specify.tasks.WorkbenchTask.java

/**
 * If the colInfo Vector is null then all the templates are added to the list to be displayed.<br>
 * If not, then it checks all the column in the file against the columns in each Template to see if there is a match
 * and then uses that./* w w w.ja  v a  2  s.co m*/
 * show a Dialog and returns null if there are not templates or none match.
 * @param colInfo the column info
 * @param helpContext the help context
 * 
 * @return a List. The first element in the pair is false then the selection was cancelled. 
 * Otherwise, the second element will be the selected WorkbenchTemplate or null if a new template should be created,
 * and the third element will be a list of columns that are not used in the selected template
 */
public List<?> selectExistingTemplate(final Vector<ImportColumnInfo> colInfo, final String helpContext) {
    WorkbenchTemplate selection = null;

    if (colInfo != null) {
        Collections.sort(colInfo);
    }

    Vector<WorkbenchTemplate> matchingTemplates = new Vector<WorkbenchTemplate>();
    HashMap<WorkbenchTemplate, Vector<?>> unMappedCols = new HashMap<WorkbenchTemplate, Vector<?>>();

    // Check for any matches with existing templates
    DataProviderSessionIFace session = DataProviderFactory.getInstance().createSession();
    try {
        //List<?> list = session.getDataList("From WorkbenchTemplate where SpecifyUserID = " + AppContextMgr.getInstance().getClassObject(SpecifyUser.class).getSpecifyUserId());
        List<?> list = session.getDataList("From WorkbenchTemplate");
        for (Object obj : list) {
            WorkbenchTemplate template = (WorkbenchTemplate) obj;
            if (colInfo == null) {
                template.forceLoad();
                matchingTemplates.add(template);

                //} else if (colInfo.size() <= template.getWorkbenchTemplateMappingItems().size())
            } else if (colInfo.size() == template.getWorkbenchTemplateMappingItems().size()) {
                boolean match = true;
                Vector<WorkbenchTemplateMappingItem> items = new Vector<WorkbenchTemplateMappingItem>(
                        template.getWorkbenchTemplateMappingItems());
                Vector<ImportColumnInfo> mapped = new Vector<ImportColumnInfo>();
                for (ImportColumnInfo col : colInfo) {
                    int idx = indexOfName(items, col.getColName());
                    if (idx != -1) {
                        mapped.add(col);
                        items.get(idx).setViewOrder(Short.valueOf(col.getColInx().toString()));
                        items.get(idx).setOrigImportColumnIndex(Short.valueOf(col.getColInx().toString()));
                    } else {
                        match = false;
                        break;
                    }
                }
                if (match) {
                    Vector<WorkbenchTemplateMappingItem> unmapped = new Vector<WorkbenchTemplateMappingItem>();
                    for (WorkbenchTemplateMappingItem item : items) {
                        if (indexOfName(mapped, item.getImportedColName()) == -1) {
                            unmapped.add(item);
                            //item.setViewOrder(c++);
                        }
                    }
                    if (unmapped.size() == 0) {
                        matchingTemplates.insertElementAt(template, 0); //put full matches at head of list
                    } else {
                        matchingTemplates.add(template);
                    }
                    unMappedCols.put(template, unmapped);
                    //for (WorkbenchTemplateMappingItem unmappedItem : unmapped)
                    //{
                    //   template.getWorkbenchTemplateMappingItems().remove(unmappedItem);
                    //}
                }
            }
            //                else if (colInfo.size() > template.getWorkbenchTemplateMappingItems().size())
            //                {
            //                    boolean match = true;
            //                    Vector<WorkbenchTemplateMappingItem> items = new Vector<WorkbenchTemplateMappingItem>(template.getWorkbenchTemplateMappingItems());
            //                    Vector<ImportColumnInfo> mapped = new Vector<ImportColumnInfo>();
            //                    for (WorkbenchTemplateMappingItem item : items)
            //                    {
            //                       int idx = indexOfName(colInfo, item.getImportedColName());
            //                       if (idx != -1)
            //                       {
            //                          mapped.add(colInfo.get(idx));
            //                          item.setViewOrder(Short.valueOf(colInfo.get(idx).getColInx().toString()));
            //                          item.setOrigImportColumnIndex(Short.valueOf(colInfo.get(idx).getColInx().toString()));
            //                       }
            //                    }
            //                    for (int i=0; i<items.size(); i++)
            //                    {
            //                        WorkbenchTemplateMappingItem wbItem = items.get(i);
            //                        int origIdx = wbItem.getOrigImportColumnIndex().intValue();
            //                        if (origIdx == -1)
            //                        {
            //                           //try the viewOrder
            //                           origIdx = wbItem.getViewOrder().intValue();
            //                        }
            //                        ImportColumnInfo fileItem = origIdx > -1 && origIdx < colInfo.size() ? colInfo.get(origIdx) : null;
            //                        // Check to see if there is an exact match by name
            //                        if (colsMatchByName(wbItem, fileItem))
            //                        {
            //                           //might do additional type checking
            //                           mapped.add(fileItem);
            //                        }
            //                        else
            //                        {
            //                            //log.error("["+wbItem.getImportedColName()+"]["+fileItem.getColName()+"]");
            //                            match = false;
            //                            break;
            //                        }
            //                    }
            //                    // All columns match with their order etc.
            //                    if (match)
            //                    {
            //                        matchingTemplates.add(template);
            //                        Vector<ImportColumnInfo> unmapped = new Vector<ImportColumnInfo>();
            //                        for (ImportColumnInfo fileItem : colInfo)
            //                        {
            //                           if (mapped.indexOf(fileItem) == -1)
            //                           {
            //                              unmapped.add(fileItem);
            //                           }
            //                        }
            //                        unMappedCols.put(template, unmapped);
            //                    }
            //                }
        }

    } catch (Exception ex) {
        edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount();
        edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(WorkbenchTask.class, ex);
        log.error(ex);
        ex.printStackTrace();

    } finally {
        session.close();
    }

    Vector<Object> result = new Vector<Object>();
    // Ask the user to choose an existing template.
    if (matchingTemplates.size() > 0) {
        SelectNewOrExistingDlg<WorkbenchTemplate> dlg = new SelectNewOrExistingDlg<WorkbenchTemplate>(
                (Frame) UIRegistry.get(UIRegistry.FRAME), "WB_CHOOSE_DATASET_REUSE_TITLE",
                "WB_CREATE_NEW_MAPPING", "WB_USE_EXISTING_MAPPING", helpContext, matchingTemplates);

        UIHelper.centerAndShow(dlg);

        if (dlg.getBtnPressed() == ChooseFromListDlg.OK_BTN) {
            if (!dlg.isCreateNew()) {
                selection = dlg.getSelectedObject();
                Vector<?> unmapped = unMappedCols.get(selection);
                if (unmapped != null && unmapped.size() > 0) {
                    StringBuilder flds = new StringBuilder();
                    for (Object info : unmapped) //if there are a lot of these the message will be ugly
                    {
                        if (flds.length() != 0) {
                            flds.append(", ");
                        }
                        flds.append(info.toString());
                    }
                    String msg = unmapped.get(0) instanceof ImportColumnInfo
                            ? String.format(UIRegistry.getResourceString("WB_UNMAPPED_NOT_IMPORTED"),
                                    flds.toString())
                            : String.format(UIRegistry.getResourceString("WB_UNUSED_NOT_INCLUDED"),
                                    flds.toString());
                    if (!UIRegistry.displayConfirm(UIRegistry.getResourceString("WB_INCOMPLETE_MAP_TITLE"), msg,
                            UIRegistry.getResourceString("YES"), UIRegistry.getResourceString("NO"),
                            JOptionPane.WARNING_MESSAGE)) {
                        result.add(true);
                        return result; // means create a new one
                    }
                }

                //                    for (WorkbenchTemplateMappingItem mi : selection.getWorkbenchTemplateMappingItems())
                //                    {
                //                       System.out.println(mi.getImportedColName() + " - " + mi.getViewOrder());
                //                    }
                result.add(true);
                result.add(selection);
                result.add(unMappedCols.get(selection));
                return result; // means reuse an existing one
            }
            result.add(true);
            return result; // means create a new one
        }
        result.add(false);
        return result; //cancelled
    }
    result.add(true);
    return result; // means create a new one
}

From source file:fitnesserefactor.FitnesseRefactor.java

private void deleteColBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteColBtnActionPerformed
    if (ParentFolder.isSelected()) {
        if (!"".equals(JtreePath)) {
            File dir = new File(JtreePath);
            try {
                if (dir.getParent() != null && dir.isFile()) {
                    String Testcase = dir.getParent();
                    File dir1 = new File(Testcase);
                    if (dir1.getParent() != null && dir1.isDirectory()) {
                        String parent = dir1.getParent();
                        File dir2 = new File(Testcase);
                        if (dir2.getParent() != null) {
                            String GrandParent = dir2.getParent();
                            File dir3 = new File(GrandParent);
                            File[] allFiles = dir3.listFiles();
                            ArrayList al = new ArrayList();
                            for (File file : allFiles) {
                                String TestcaseNames = file.getName();
                                al.add(TestcaseNames);
                            }//from w  ww .  j  a v  a2s.  co  m
                            if (!fromTxt.getText().isEmpty() && !toTxt.getText().isEmpty()) {
                                int FromTxtInt = Integer.parseInt(fromTxt.getText());
                                int ToTxtInt = Integer.parseInt(toTxt.getText());
                                int TotFiles = al.size();
                                if ((ToTxtInt > FromTxtInt) && (ToTxtInt > 0) && (FromTxtInt > 0)
                                        && ToTxtInt <= al.size() - 2) {
                                    for (int removeAfterToIndx = (ToTxtInt
                                            + 2); removeAfterToIndx < TotFiles; removeAfterToIndx++) {
                                        al.remove(ToTxtInt + 2);
                                    }
                                    if (FromTxtInt > 1) {
                                        for (int removeFromIndx = 1; removeFromIndx < FromTxtInt; removeFromIndx++) {
                                            al.remove(2);
                                        }
                                    }

                                } else {
                                    JOptionPane.showMessageDialog(null,
                                            "FROM test case number cannot be greater/equal to TO test case number.\nFROM and TO test case numbers should be greater than zero. \nTO test case number should not be greater than the testcase count ",
                                            "Warning", JOptionPane.WARNING_MESSAGE);
                                }
                            }
                            for (int i = 2; i <= al.size(); i++) {
                                System.out.println(dir2.getParent() + "\\" + al.get(i) + "\\content.txt");
                                File EachFile = new File(dir2.getParent() + "\\" + al.get(i) + "\\content.txt");
                                for (int j = 0; j < FileUtils.readLines(EachFile).size(); j++) {
                                    String line = (String) FileUtils.readLines(EachFile).get(j);
                                    if (line.matches("(.*)" + FitnesseTablesList.getSelectedItem().toString()
                                            + "(.*)")) {
                                        p = j;
                                        ReadAllLines(EachFile);
                                        int linNum = CountLines(EachFile);
                                        DeleteColumn(EachFile, Integer.parseInt(ColumnField.getText()));
                                        int DelColsLen = DeletedSubLines.size();
                                        int tblIndex = 1;
                                        for (int SetNew = 0; SetNew < DelColsLen; SetNew++) {
                                            AllLines.set(p + tblIndex, DeletedSubLines.get(SetNew).toString());
                                            tblIndex = tblIndex + 1;
                                        }
                                        WriteAllLines(EachFile);
                                    }
                                }
                            }
                        } else {
                            JOptionPane.showMessageDialog(null,
                                    "There are no testcases under the parent folder", "Error",
                                    JOptionPane.ERROR_MESSAGE);
                        }
                    } else {
                        JOptionPane.showMessageDialog(null, "There are no testcases under the parent folder",
                                "Error", JOptionPane.ERROR_MESSAGE);
                    }
                } else {
                    JOptionPane.showMessageDialog(null, "Need to select atleast one content.txt file",
                            "Warning", JOptionPane.WARNING_MESSAGE);
                }
            } catch (Exception E) {
                //JOptionPane.showMessageDialog(null, E, "Java Runtime Error", JOptionPane.ERROR );
            }
        }

    }
}

From source file:com.mirth.connect.connectors.jms.JmsConnectorPanel.java

private boolean confirmDialog(String message) {
    return (JOptionPane.YES_OPTION == JOptionPane.showConfirmDialog(parent, message, "Confirm",
            JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE));
}