List of usage examples for javax.swing JOptionPane WARNING_MESSAGE
int WARNING_MESSAGE
To view the source code for javax.swing JOptionPane WARNING_MESSAGE.
Click Source Link
From source file:ome.formats.importer.gui.GuiImporter.java
/** * Display errors in candidates dialog/*ww w . ja v a 2 s . c o m*/ * * @param frame - parent frame */ public void candidateErrorsCollected(Component frame) { errors_pending = false; final JOptionPane optionPane = new JOptionPane( "\nAdding these files to the queue has produced one or more errors and some" + "\n files will not be displayed on the queue. View the 'Import Errors' tab for details.", JOptionPane.WARNING_MESSAGE); final JDialog errorDialog = new JDialog(this, "Errors Collected", true); errorDialog.setContentPane(optionPane); optionPane.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent e) { String prop = e.getPropertyName(); if (errorDialog.isVisible() && (e.getSource() == optionPane) && (prop.equals(JOptionPane.VALUE_PROPERTY))) { errorDialog.dispose(); } } }); errorDialog.toFront(); errorDialog.pack(); errorDialog.setLocationRelativeTo(frame); errorDialog.setVisible(true); }
From source file:ome.formats.importer.gui.GuiImporter.java
/** * Display failed sending errors dialog// ww w. ja v a 2 s .c om * * @param frame - parent frame */ public void sendingErrorsFailed(Component frame) { final JOptionPane optionPane = new JOptionPane( "\nDue to an error we were not able to send your error messages." + "\nto our feedback server. Please try again.", JOptionPane.WARNING_MESSAGE); final JDialog failedDialog = new JDialog(this, "Feedback Failed!", true); failedDialog.setContentPane(optionPane); optionPane.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent e) { String prop = e.getPropertyName(); if (failedDialog.isVisible() && (e.getSource() == optionPane) && (prop.equals(JOptionPane.VALUE_PROPERTY))) { failedDialog.dispose(); } } }); failedDialog.toFront(); failedDialog.pack(); failedDialog.setLocationRelativeTo(frame); failedDialog.setVisible(true); }
From source file:ome.formats.importer.gui.HistoryTable.java
/** * Clear the history table of all data/*from www.j av a2 s. c o m*/ */ private void ClearHistory() { String message = "This will delete your import history. \n" + "Are you sure you want to continue?"; Object[] o = { "Yes", "No" }; int result = JOptionPane.showOptionDialog(this, message, "Warning", -1, JOptionPane.WARNING_MESSAGE, null, o, o[1]); if (result == 0) //yes clicked { try { db.wipeDataSource(getExperimenterID()); } catch (ServerError e) { log.error("exception.", e); } updateOutlookBar(); getItemQuery(-1, getExperimenterID(), searchField.getText(), fromDate.getDate(), toDate.getDate()); } }
From source file:ome.formats.importer.gui.ImportDialog.java
/** * Dialog explaining metadata limitations when changing the main dialog's naming settings * //from ww w .j av a2s . c o m * @param frame - parent component */ public void sendNamingWarning(Component frame) { final JOptionPane optionPane = new JOptionPane( "\nNOTE: Some file formats do not include the file name in their metadata, " + "\nand disabling this option may result in files being imported without a " + "\nreference to their file name. For example, 'myfile.lsm [image001]' " + "\nwould show up as 'image001' with this optioned turned off.", JOptionPane.WARNING_MESSAGE); final JDialog warningDialog = new JDialog(this, "Naming Warning!", true); warningDialog.setContentPane(optionPane); optionPane.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent e) { String prop = e.getPropertyName(); if (warningDialog.isVisible() && (e.getSource() == optionPane) && (prop.equals(JOptionPane.VALUE_PROPERTY))) { warningDialog.dispose(); } } }); warningDialog.toFront(); warningDialog.pack(); warningDialog.setLocationRelativeTo(frame); warningDialog.setVisible(true); }
From source file:openqcm.mainGUI.java
/** * Creates new form mainGUI// w ww. j ava2s. c om */ public mainGUI() { // Show the splash screen appInit(); // Generated code initialize GUI components initComponents(); CommentSection cs = new CommentSection(); cs.setVisible(true); jButton3.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // display/center the jdialog when the button is pressed DateFormat df = new SimpleDateFormat("HH:mm:ss"); Date dateobj = new Date(); cs.addData(df.format(dateobj), jTextArea1.getText().toString()); } }); //add listener to the button addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent we) { String ObjButtons[] = { "Yes", "No" }; int PromptResult = JOptionPane.showOptionDialog(null, "Are you sure you want to exit?", "Online Examination System", JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null, ObjButtons, ObjButtons[1]); if (PromptResult == 0) { System.exit(0); } } }); // Register a RawDataListener to receive data from Arduino. link.addRawDataListener(this); }
From source file:org.accretegb.modules.germplasm.stockannotation.StockAnnotationPanel.java
/** * actions after click upload, clear buttons associated with Classification Code table, and actions after click inside ClassificationCode * table/*from www . j a va 2 s .com*/ */ private void addClassificationCodeListeners() { classificationTablePanel.getEditButton().setEnabled(false); classificationTablePanel.getDeleteButton().setEnabled(false); classificationTablePanel.getUploadButton().setEnabled(false); classificationTablePanel.getClearButton().setEnabled(false); addClassificationCodeAddButtonListener(); addClassificationCodeEditButtonListener(); addClassificationCodeDeleteButtonListener(); classificationTablePanel.getUploadButton().addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { int validRow = 0; int selectedRows[] = stockTablePanel.getTable().getSelectedRows(); //System.out.print("\nselected row" + stockTablePanel.getTable().getSelectedRowCount()); Integer sampVal = (Integer) ((DefaultTableModel) classificationTable.getModel()).getValueAt( classificationSelectedRow, classificationTable.getColumn("Classification id").getModelIndex()); String germplasm = (String) ((DefaultTableModel) classificationTable.getModel()).getValueAt( classificationSelectedRow, classificationTable.getColumn("Classification Code").getModelIndex()); for (int rowCounter = 0; rowCounter < stockTablePanel.getTable() .getSelectedRowCount(); rowCounter++) { // only selected rows can be uploaded with data. if (!StringUtils .isEmpty(String.valueOf(stockTablePanel.getTable().getValueAt(selectedRows[rowCounter], stockTablePanel.getTable().getColumn(ColumnConstants.ACCESSION) .getModelIndex()))) || !(StringUtils.isEmpty(String.valueOf( stockTablePanel.getTable().getValueAt(selectedRows[rowCounter], stockTablePanel .getTable().getColumn(ColumnConstants.PEDIGREE).getModelIndex()))))) { stockTablePanel.getTable().setValueAt(sampVal, selectedRows[rowCounter], stockTablePanel.getTable().getIndexOf(ColumnConstants.CLASSIFICATION_ID)); stockTablePanel.getTable().setValueAt(germplasm, selectedRows[rowCounter], stockTablePanel.getTable().getIndexOf(ColumnConstants.CLASSIFICATION_CODE)); validRow++; } } ((DefaultTableModel) classificationTable.getModel()).setValueAt(false, classificationSelectedRow, 0); if (validRow != stockTablePanel.getTable().getSelectedRowCount()) { // AccreteGBLogger.logger.log(Level.INFO, // "Either Acceesion or Pedigree is mandatory for uploading"); JOptionPane.showConfirmDialog(StockAnnotationPanel.this, "Either Acceesion or Pedigree is mandatory for uploading", "Warning!", JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE); } clearClassificationCodeSelection(); } }); classificationTablePanel.getClearButton().addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { for (int rowCounter = 0; rowCounter < stockTablePanel.getTable().getRowCount(); rowCounter++) { if (!StringUtils.isEmpty(String.valueOf(stockTablePanel.getTable().getValueAt(rowCounter, stockTablePanel.getTable().getColumn(ColumnConstants.ACCESSION).getModelIndex()))) || !(StringUtils.isEmpty( String.valueOf(stockTablePanel.getTable().getValueAt(rowCounter, stockTablePanel .getTable().getColumn(ColumnConstants.PEDIGREE).getModelIndex()))))) { stockTablePanel.getTable().setValueAt("", rowCounter, stockTablePanel.getTable().getColumn("Classification id").getModelIndex()); stockTablePanel.getTable().setValueAt("", rowCounter, stockTablePanel.getTable().getColumn("Classification Code").getModelIndex()); } } } }); classificationTable.addMouseListener(new MouseAdapter() { public void mouseReleased(MouseEvent e) { int row = classificationTable.getSelectedRow(); classificationSelectedRow = row; if (row != -1) { classificationTablePanel.getEditButton().setEnabled(true); classificationTablePanel.getDeleteButton().setEnabled(true); if (stockTablePanel.getTable().getSelectedRowCount() > 0) { classificationTablePanel.getUploadButton().setEnabled(true); } } else { classificationTablePanel.getEditButton().setEnabled(false); classificationTablePanel.getDeleteButton().setEnabled(false); classificationTablePanel.getUploadButton().setEnabled(false); } } }); }
From source file:org.accretegb.modules.germplasm.stockannotation.StockAnnotationPanel.java
/** * actions after click delete button associated with Classification Code table *///from w w w . ja va2 s. c o m private void addClassificationCodeDeleteButtonListener() { classificationTablePanel.getDeleteButton().addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { int selrow = classificationTable.getSelectedRow(); int selcolumn = 0; String columnName = classificationTable.getColumnName(selcolumn + 1); String sampval = (String) classificationTable.getValueAt(selrow, classificationTable.getColumn(ColumnConstants.CLASSIFICATION_CODE).getModelIndex()); try { List<Passport> parentPassports = PassportDAO.getInstance().findByClassificationCode(sampval); if (parentPassports.size() > 0) { if (LoggerUtils.isLogEnabled()) LoggerUtils.log(Level.INFO, "Classification Code has passport associated with " + "it. " + "Cannot " + "delete"); JOptionPane.showConfirmDialog(StockAnnotationPanel.this, "Cannot delete classification_code associated with passports", "Error!", JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE); classificationTable.setValueAt(false, selrow, 0); classificationTable.clearSelection(); } else { ClassificationDAO.getInstance().delete(sampval); ((DefaultTableModel) classificationTable.getModel()) .removeRow(classificationTable.convertRowIndexToModel(selrow)); classificationTable.setForeground(Color.BLACK); classificationSelectedRow = -1; } } catch (HibernateException ex) { if (LoggerUtils.isLogEnabled()) LoggerUtils.log(Level.INFO, ex.toString()); } clearClassificationCodeSelection(); } }); }
From source file:org.accretegb.modules.germplasm.stockannotation.StockAnnotationPanel.java
/** * actions after click edit button associated with Classification Code table *//*w w w . j a v a 2 s.co m*/ private void addClassificationCodeEditButtonListener() { classificationTablePanel.getEditButton().addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { classificationTablePanel.getDeleteButton().setEnabled(true); classificationTablePanel.getEditButton().setEnabled(true); JPanel newSource = new JPanel(new MigLayout("insets 0, gapx 0")); String labelNames[] = { "<HTML>Classification Code<FONT COLOR = Red>*" + "</FONT></HTML>", "<HTML>Classification Type<FONT COLOR = Red>*" + "</FONT></HTML>" }; int selRow = classificationTable.getSelectedRow(); String oldClassificationCode = (String) classificationTable.getValueAt(selRow, classificationTable.getColumn(ColumnConstants.CLASSIFICATION_CODE).getModelIndex()); String oldGermplasm = (String) classificationTable.getValueAt(selRow, classificationTable.getColumn("Classification Type").getModelIndex()); String values[] = { oldClassificationCode, oldGermplasm }; boolean validInput = false; JLabel labels[] = new JLabel[labelNames.length]; final JTextField textBoxes[] = new JTextField[labelNames.length]; for (int labelCounter = 0; labelCounter < labels.length; labelCounter++) { labels[labelCounter] = new JLabel(labelNames[labelCounter]); newSource.add(labels[labelCounter], "gapleft 10, push"); textBoxes[labelCounter] = new JTextField(); textBoxes[labelCounter].setPreferredSize(new Dimension(200, 0)); textBoxes[labelCounter].setText(values[labelCounter]); newSource.add(textBoxes[labelCounter], "gapRight 10, wrap"); } do { for (int textBoxCounter = 0; textBoxCounter < labelNames.length; textBoxCounter++) textBoxes[textBoxCounter].setText(values[textBoxCounter]); int option = JOptionPane.showConfirmDialog(StockAnnotationPanel.this, newSource, "Enter New Classification Code Information ", JOptionPane.DEFAULT_OPTION); validInput = true; if (option == JOptionPane.OK_OPTION) { for (int valuesCounter = 0; valuesCounter < labelNames.length; valuesCounter++) { values[valuesCounter] = textBoxes[valuesCounter].getText(); if (labelNames[valuesCounter].indexOf('*') != -1 && textBoxes[valuesCounter].getText().equals("")) { if (LoggerUtils.isLogEnabled()) LoggerUtils.log(Level.INFO, labelNames[valuesCounter] + " " + "is " + "mandatory"); validInput = false; } } if (validInput) { Object newRow[] = updateClassificationCodeTable(values, oldClassificationCode); ((DefaultTableModel) classificationTable.getModel()) .insertRow(classificationTable.getRowCount(), newRow); for (int rowCounter = 0; rowCounter < classificationTable.getRowCount(); rowCounter++) if (((String) classificationTable.getValueAt(rowCounter, classificationTable .getColumn(ColumnConstants.CLASSIFICATION_CODE).getModelIndex())) .equals(oldClassificationCode)) ((DefaultTableModel) classificationTable.getModel()) .removeRow(classificationTable.convertRowIndexToModel(rowCounter)); } } if (!validInput) JOptionPane.showConfirmDialog(StockAnnotationPanel.this, "<HTML><FONT COLOR = Red>*</FONT> marked fields are mandatory.</HTML>", "Error!", JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE); } while (!validInput); clearClassificationCodeSelection(); } }); }
From source file:org.accretegb.modules.germplasm.stockannotation.StockAnnotationPanel.java
/** * actions after click add button associated with Classification Code table *//*w ww .j a v a 2 s . com*/ private void addClassificationCodeAddButtonListener() { classificationTablePanel.getAddButton().addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { classificationTablePanel.getDeleteButton().setEnabled(false); classificationTablePanel.getEditButton().setEnabled(false); JPanel newSource = new JPanel(new MigLayout("insets 0, gapx 0")); String labelNames[] = { "<HTML>Classification Code<FONT COLOR = Red>*" + "</FONT></HTML>", "<HTML>Classification Type<FONT COLOR = Red>*" + "</FONT></HTML>" }; String values[] = { "", "" }; boolean validInput = false; JLabel labels[] = new JLabel[labelNames.length]; final JTextField textBoxes[] = new JTextField[labelNames.length]; for (int labelCounter = 0; labelCounter < labels.length; labelCounter++) { labels[labelCounter] = new JLabel(labelNames[labelCounter]); newSource.add(labels[labelCounter], "gapleft 10, push"); textBoxes[labelCounter] = new JTextField(); textBoxes[labelCounter].setPreferredSize(new Dimension(200, 0)); textBoxes[labelCounter].setText(values[labelCounter]); newSource.add(textBoxes[labelCounter], "gapRight 10, wrap"); } do { for (int textBoxCounter = 0; textBoxCounter < labelNames.length; textBoxCounter++) textBoxes[textBoxCounter].setText(values[textBoxCounter]); int option = JOptionPane.showConfirmDialog(StockAnnotationPanel.this, newSource, "Enter New Classification Code Information ", JOptionPane.DEFAULT_OPTION); validInput = true; if (option == JOptionPane.OK_OPTION) { for (int valuesCounter = 0; valuesCounter < labelNames.length; valuesCounter++) { values[valuesCounter] = textBoxes[valuesCounter].getText(); if (labelNames[valuesCounter].indexOf('*') != -1 && textBoxes[valuesCounter].getText().equals("")) { if (LoggerUtils.isLogEnabled()) LoggerUtils.log(Level.INFO, labelNames[valuesCounter] + " " + "is " + "mandatory"); validInput = false; } } // insert new row to database & insert one row into table of interface if (validInput) { Object newRow[] = new Object[values.length + 2]; newRow[0] = new Boolean(false); for (int columnCounter = 2; columnCounter < newRow.length; columnCounter++) newRow[columnCounter] = values[columnCounter - 2]; try { newRow[1] = ClassificationDAO.getInstance().insert(values).getClassificationId() .toString(); } catch (HibernateException ex) { if (LoggerUtils.isLogEnabled()) LoggerUtils.log(Level.INFO, ex.toString()); } ((DefaultTableModel) classificationTable.getModel()) .insertRow(classificationTable.getRowCount(), newRow); } } if (!validInput) JOptionPane.showConfirmDialog(StockAnnotationPanel.this, "<HTML><FONT COLOR = Red>*</FONT> marked fields are mandatory.</HTML>", "Error!", JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE); } while (!validInput); clearClassificationCodeSelection(); } }); }
From source file:org.accretegb.modules.germplasm.stockannotation.StockAnnotationPanel.java
/** * actions after click upload, clear buttons associated with Taxonomy table, and actions after click taxonomy table *//* w w w .ja v a 2 s . co m*/ private void addTaxonomyListeners() { // no edit, delete, upload, clear functions allowed taxonomyTablePanel.getEditButton().setEnabled(false); taxonomyTablePanel.getDeleteButton().setEnabled(false); taxonomyTablePanel.getUploadButton().setEnabled(false); taxonomyTablePanel.getClearButton().setEnabled(false); // add, edit, delete button listener addTaxonomyAddButtonListener(); addTaxonomyEditButtonListener(); addTaxonomyDeleteButtonListener(); // actions after click upload button taxonomyTablePanel.getUploadButton().addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { int validRow = 0; int selectedRows[] = stockTablePanel.getTable().getSelectedRows(); String taxVal = (String) ((DefaultTableModel) taxonomyTable.getModel()) .getValueAt(taxonomySelectedRow, taxonomyTable.getColumn("Taxonomy id").getModelIndex()); String value = "" + ((String) ((DefaultTableModel) taxonomyTable.getModel()).getValueAt(taxonomySelectedRow, taxonomyTable.getColumn("Genus").getModelIndex())).charAt(0) + ((String) ((DefaultTableModel) taxonomyTable.getModel()).getValueAt( taxonomySelectedRow, taxonomyTable.getColumn("Species").getModelIndex())).charAt(0) + " (" + ((String) ((DefaultTableModel) taxonomyTable.getModel()).getValueAt(taxonomySelectedRow, taxonomyTable.getColumn("Race").getModelIndex())) + ") " + ((String) ((DefaultTableModel) taxonomyTable.getModel()).getValueAt(taxonomySelectedRow, taxonomyTable.getColumn(ColumnConstants.POPULATION).getModelIndex())); for (int rowCounter = 0; rowCounter < stockTablePanel.getTable() .getSelectedRowCount(); rowCounter++) { // only selected rows can be uploaded data. if (!StringUtils .isEmpty(String.valueOf(stockTablePanel.getTable().getValueAt(selectedRows[rowCounter], stockTablePanel.getTable().getColumn(ColumnConstants.ACCESSION) .getModelIndex()))) || !(StringUtils.isEmpty(String.valueOf( stockTablePanel.getTable().getValueAt(selectedRows[rowCounter], stockTablePanel .getTable().getColumn(ColumnConstants.PEDIGREE).getModelIndex()))))) { stockTablePanel.getTable().setValueAt(taxVal, selectedRows[rowCounter], stockTablePanel.getTable().getColumn("Taxonomy id").getModelIndex()); stockTablePanel.getTable().setValueAt(value, selectedRows[rowCounter], stockTablePanel.getTable().getColumn("Population").getModelIndex()); validRow++; } } if (validRow != stockTablePanel.getTable().getSelectedRowCount()) { // AccreteGBLogger.logger.log(Level.INFO, // "Either Acceesion or Pedigree is mandatory for uploading"); JOptionPane.showConfirmDialog(StockAnnotationPanel.this, "Either Acceesion or Pedigree is mandatory for uploading", "Warning!", JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE); } ((DefaultTableModel) taxonomyTable.getModel()).setValueAt(false, taxonomySelectedRow, 0); clearTaxonomySelection(); } }); // actions after click clear button taxonomyTablePanel.getClearButton().addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { for (int rowCounter = 0; rowCounter < stockTablePanel.getTable().getRowCount(); rowCounter++) { if ((Boolean) stockTablePanel.getTable().getValueAt(rowCounter, 0) == true) { stockTablePanel.getTable().setValueAt("", rowCounter, stockTablePanel.getTable().getColumn("Taxonomy id").getModelIndex()); stockTablePanel.getTable().setValueAt("", rowCounter, stockTablePanel.getTable().getColumn("Population").getModelIndex()); } } } }); // actions to do after click taxonomy table taxonomyTable.addMouseListener(new MouseAdapter() { public void mouseReleased(MouseEvent e) { int row = taxonomyTable.getSelectedRow(); taxonomySelectedRow = row; if (row != -1) { taxonomyTablePanel.getEditButton().setEnabled(true); taxonomyTablePanel.getDeleteButton().setEnabled(true); if (stockTablePanel.getTable().getRowCount() > 0) { taxonomyTablePanel.getUploadButton().setEnabled(true); } } else { taxonomyTablePanel.getEditButton().setEnabled(false); taxonomyTablePanel.getDeleteButton().setEnabled(false); taxonomyTablePanel.getUploadButton().setEnabled(false); } } }); }