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:com.compomics.colims.client.controller.admin.FastaDbSaveUpdateController.java
@Override @PostConstruct/*from w w w .j a va 2 s. c om*/ public void init() { //register to event bus eventBus.register(this); fastaDbSaveUpdatePanel = fastaDbManagementController.getFastaDbManagementDialog() .getFastaDbSaveUpdatePanel(); headerParseRuleAdditionDialog = new HeaderParseRuleAdditionDialog( fastaDbManagementController.getFastaDbManagementDialog(), true); taxonomyBindingList = ObservableCollections.observableList(new ArrayList<>()); taxonomyBindingList.add(TAXONOMY_CV_PARAM_NONE); taxonomyBindingList.addAll(cvParamService.findByCvParamByClass(TaxonomyCvParam.class)); //init binding bindingGroup = new BindingGroup(); JComboBoxBinding taxonomyComboBoxBinding = SwingBindings.createJComboBoxBinding( AutoBinding.UpdateStrategy.READ_WRITE, taxonomyBindingList, fastaDbSaveUpdatePanel.getTaxomomyComboBox()); bindingGroup.addBinding(taxonomyComboBoxBinding); headerParseRuleBindingList = ObservableCollections.observableList(new ArrayList<>()); try { config = PropertiesUtil.parsePropertiesFile("config/header-parse-rule.properties"); } catch (IOException | ConfigurationException ex) { java.util.logging.Logger.getLogger(FastaDbSaveUpdateController.class.getName()).log(Level.SEVERE, null, ex); } fillHeaderParseRuleComboBox(); JComboBoxBinding parseRuleComboBoxBinding = SwingBindings.createJComboBoxBinding( AutoBinding.UpdateStrategy.READ_WRITE, headerParseRuleBindingList, fastaDbSaveUpdatePanel.getHeaderParseRuleComboBox()); bindingGroup.addBinding(parseRuleComboBoxBinding); databaseBindingList = ObservableCollections.observableList(new ArrayList<>()); Properties allProperties = new Properties(); ClassLoader loader = Thread.currentThread().getContextClassLoader(); try { allProperties.load(loader.getResourceAsStream("config/embl-ebi-database.properties")); databaseSet = new TreeSet(allProperties.keySet()); } catch (IOException ex) { java.util.logging.Logger.getLogger(FastaDbSaveUpdateController.class.getName()).log(Level.SEVERE, null, ex); } fillDatabaseComboBox(); JComboBoxBinding databaseComboBoxBinding = SwingBindings.createJComboBoxBinding( AutoBinding.UpdateStrategy.READ_WRITE, databaseBindingList, fastaDbSaveUpdatePanel.getDatabaseComboBox()); bindingGroup.addBinding(databaseComboBoxBinding); bindingGroup.bind(); //init FASTA file selection //disable select multiple files fastaDbSaveUpdatePanel.getFastaFileChooser().setMultiSelectionEnabled(false); //set FASTA file filter fastaDbSaveUpdatePanel.getFastaFileChooser().setFileFilter(new FastaFileFilter()); //add listeners fastaDbSaveUpdatePanel.getBrowseTaxonomyButton().addActionListener(e -> { List<CvParam> cvParams = cvParamService.findByCvParamByClass(TaxonomyCvParam.class); //update the CV param list cvParamManagementController.updateDialog("FASTA DB taxonomy", TaxonomyCvParam.class, PRESELECTED_ONTOLOGY_NAMESPACES, cvParams); cvParamManagementController.showView(); }); fastaDbSaveUpdatePanel.getBrowseHeaderParseRuleButtton().addActionListener(l -> { headerParseRuleAdditionDialog.getParseRuleTextField().setText(""); headerParseRuleAdditionDialog.getDescriptionTextField().setText(""); GuiUtils.centerDialogOnComponent(fastaDbSaveUpdatePanel, headerParseRuleAdditionDialog); headerParseRuleAdditionDialog.setVisible(true); }); headerParseRuleAdditionDialog.getSaveParseRuleButton().addActionListener(l -> { try { config = PropertiesUtil.addProperty(config, headerParseRuleAdditionDialog.getDescriptionTextField().getText(), headerParseRuleAdditionDialog.getParseRuleTextField().getText()); } catch (ConfigurationException | IOException ex) { java.util.logging.Logger.getLogger(FastaDbSaveUpdateController.class.getName()).log(Level.SEVERE, null, ex); } fillHeaderParseRuleComboBox(); headerParseRuleAdditionDialog.dispose(); }); fastaDbSaveUpdatePanel.getBrowseFastaButton().addActionListener(e -> { //in response to the button click, show open dialog int returnVal = fastaDbSaveUpdatePanel.getFastaFileChooser().showOpenDialog(fastaDbSaveUpdatePanel); if (returnVal == JFileChooser.APPROVE_OPTION) { File fastaFile = fastaDbSaveUpdatePanel.getFastaFileChooser().getSelectedFile(); //show FASTA file name and path in textfields fastaDbSaveUpdatePanel.getFileNameTextField().setText(fastaFile.getName()); fastaDbSaveUpdatePanel.getFilePathTextField().setText(fastaFile.getAbsolutePath()); } }); fastaDbSaveUpdatePanel.getSaveOrUpdateButton().addActionListener(e -> { //validate FASTA DB updateFastaToEdit(); List<String> validationMessages = GuiUtils.validateEntity(fastaDbToEdit); if (validationMessages.isEmpty()) { if (fastaDbToEdit.getId() != null) { fastaDbToEdit = fastaDbService.merge(fastaDbToEdit); fastaDbManagementController.updateFastaDb(); } else { fastaDbService.persist(fastaDbToEdit); fastaDbManagementController.addFastaDb(fastaDbToEdit); } fastaDbSaveUpdatePanel.getNameTextField().setEnabled(false); fastaDbSaveUpdatePanel.getSaveOrUpdateButton().setText("update"); fastaDbSaveUpdatePanel.getFastaDbStateInfoLabel().setText(""); saveUpdate = true; MessageEvent messageEvent = new MessageEvent("Fasta DB store confirmation", "Fasta DB " + fastaDbToEdit.getName() + " was stored successfully!", JOptionPane.INFORMATION_MESSAGE); eventBus.post(messageEvent); fastaDbManagementController.showOverviewPanel(); } else { MessageEvent messageEvent = new MessageEvent("Validation failure", validationMessages, JOptionPane.WARNING_MESSAGE); eventBus.post(messageEvent); } }); fastaDbSaveUpdatePanel.getBackButton().addActionListener(e -> { if (!saveUpdate) { fastaDbManagementController.setSelectedFasta(-1); } saveUpdate = false; fastaDbManagementController.showOverviewPanel(); }); }
From source file:net.sf.firemox.stack.EventManager.java
/** * remove all events in the stack of this phase, read new system abilities, * turn structure and set the current phase. * <ul>/* w ww.ja v a 2s .c o m*/ * Structure of InputStream : Data[size] * <li>number of phases type [1]</li> * <li>phases type i [...]</li> * <li>number of phases in one turn [1]</li> * <li>phase identifier i [1]</li> * <li>phase index (not identifier) for first turn [1]</li> * <li>number of state based ability of play [1]</li> * <li>state based ability i [...]</li> * <li>number of static modifier of game [1]</li> * <li>static modifier of game i [...]</li> * </ul> * * @param dbStream * the MDB file containing rules * @param settingFile * setting file attached to this MDB * @throws IOException */ public static void init(FileInputStream dbStream, String settingFile) throws IOException { nextCurrentPlayer = -1; nextPhaseIndex = -1; // remove all event listener MEventListener.reset(); // read the different phase types int nbPhases = dbStream.read(); PhaseType[] phaseTypes = new PhaseType[nbPhases]; while (nbPhases-- > 0) { PhaseType phaseType = new PhaseType(dbStream); phaseTypes[phaseType.id] = phaseType; } // read the turn structure int nbPhasesPerTurn = dbStream.read(); turnStructure = new PhaseType[nbPhasesPerTurn]; Log.debug("Turn Structure :"); for (int i = 0; i < nbPhasesPerTurn; i++) { turnStructure[i] = phaseTypes[dbStream.read()]; Log.debug("\t" + i + ":" + turnStructure[i].phaseName); } // first phase index int startIdPhase = dbStream.read(); Log.debug( "First phase of first turn is " + turnStructure[startIdPhase].phaseName + "(" + startIdPhase + ")"); // read phases GUI try { final InputStream in = MToolKit.getResourceAsStream(settingFile.replace(".mdb", ".pref")); MPhase.phases = new MPhase[2][turnStructure.length]; for (int i = 0; i < turnStructure.length; i++) { MPhase.phases[0][i] = new MPhase(turnStructure[i], 0, in); } for (int i = 0; i < EventManager.turnStructure.length; i++) { MPhase.phases[1][i] = new MPhase(turnStructure[i], 1, in); } IOUtils.closeQuietly(in); } catch (IOException e) { JOptionPane.showMessageDialog(MagicUIComponents.magicForm, LanguageManager.getString("loadtbssettingspb") + " : " + e.getMessage() + e.getStackTrace()[0], LanguageManager.getString("error"), JOptionPane.WARNING_MESSAGE); } // read triggered abilities of play int nbTriggered = dbStream.read(); Log.debug("System abilities (" + nbTriggered + "):"); while (nbTriggered-- > 0) { // read the ability and register it AbilityFactory.readAbility(dbStream, SystemCard.instance).registerToManager(); } // reset the breakpoints, options and initialize all phases graphics for (int i = MPhase.phases[0].length; i-- > 1;) { MPhase.phases[0][i].reset(); MPhase.phases[1][i].reset(); } // set the current phase to ID__PHASE_MAIN phaseIndex = startIdPhase - 1; currentIdPhase = turnStructure[phaseIndex].id; parsingBeforePhaseEvent = false; parsingEndPhaseEvent = false; replacingBefore = false; // read static-modifiers of game int nbStaticModifiers = dbStream.read(); Log.debug("Static-modifiers (" + nbStaticModifiers + "):"); while (nbStaticModifiers-- > 0) { // read the static-modifiers and register them ModifierFactory.readModifier(dbStream).addModifierFromModel(SystemAbility.instance, SystemCard.instance); } }
From source file:sim.util.media.chart.ChartGenerator.java
/** Stops a Quicktime movie and cleans up, flushing the remaining frames out to disk. This method ought to be called from the main event loop. */ public void stopMovie() { if (movieMaker == null) return; // already stopped if (!movieMaker.stop()) { Object[] options = { "Drat" }; JOptionPane.showOptionDialog(this, "Your movie did not write to disk\ndue to a spurious JMF movie generation bug.", "JMF Movie Generation Bug", JOptionPane.OK_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[0]);//from w w w .j a v a 2 s.c o m } movieMaker = null; if (movieButton != null) // hasn't been destroyed yet { movieButton.setText("Create Movie"); } }
From source file:frames.consulta.java
public void Ver() { int filase = tblconsulta.getSelectedRow(); try {/*from w ww .j a v a2s . c o m*/ String cedula, nombre, ape, edad, direccion; if (filase == -1) { JOptionPane.showMessageDialog(null, "Debe Seleccionar un Paciente", "Advertencia", JOptionPane.WARNING_MESSAGE); } else { modelo = (DefaultTableModel) tblconsulta.getModel(); cedula = tblconsulta.getValueAt(filase, 0).toString(); nombre = tblconsulta.getValueAt(filase, 1).toString(); ape = tblconsulta.getValueAt(filase, 2).toString(); edad = tblconsulta.getValueAt(filase, 3).toString(); direccion = tblconsulta.getValueAt(filase, 4).toString(); new consultahistoria().setVisible(true); consultahistoria.txtcedula.setText(cedula); consultahistoria.txtnombre.setText(nombre); consultahistoria.txtapellido.setText(ape); consultahistoria.txtedad.setText(edad); consultahistoria.txtcicitas.setText(cedula); //consultahistoria.txtdireccion.setText(direccion); // this.setVisible(false); consultaVer(cedula); cargarCitas(cedula); } } catch (Exception e) { //registro.action = "Ver"; } }
From source file:be.ugent.maf.cellmissy.gui.controller.analysis.singlecell.filtering.MultipleCutOffFilteringController.java
/** * Private methods and classes//from www. j a v a2 s .c om */ // initialize the main view private void initMainView() { // make a new view multipleCutOffPanel = new MultipleCutOffPanel(); // make a new radio button group for the radio buttons ButtonGroup radioButtonGroup = new ButtonGroup(); radioButtonGroup.add(multipleCutOffPanel.getPixelRadioButton()); radioButtonGroup.add(multipleCutOffPanel.getMicroMeterRadioButton()); // pixels or m? multipleCutOffPanel.getPixelRadioButton().addActionListener((ActionEvent e) -> { multipleCutOffPanel.getConversionFactorTextField().setEnabled(true); }); multipleCutOffPanel.getMicroMeterRadioButton().addActionListener((ActionEvent e) -> { // m: we do not need a conversion factor multipleCutOffPanel.getConversionFactorTextField().setEnabled(false); }); // set default to micrometer multipleCutOffPanel.getMicroMeterRadioButton().setSelected(true); // and therefore no need for the conversion factor multipleCutOffPanel.getConversionFactorTextField().setEnabled(false); // set some default values for the top and bottom translocaton limits multipleCutOffPanel.getBottomLimTextField().setText("0.4"); multipleCutOffPanel.getTopLimTextField().setText("2.8"); multipleCutOffPanel.getTranslocationStepTextField().setText("0.8"); multipleCutOffPanel.getPercentageMotileStepsTextField().setText("30"); percentageMotile = 33; // actually do the filtering multipleCutOffPanel.getFilterButton().addActionListener((ActionEvent e) -> { // try to read the user-inserted values for up and down limit // check for number format exception try { if (multipleCutOffPanel.getPixelRadioButton().isSelected()) { double conversionFactor = Double .parseDouble(multipleCutOffPanel.getConversionFactorTextField().getText()); multipleCutOffPanel.getBottomLimTextField() .setText("" + AnalysisUtils.roundTwoDecimals( Double.parseDouble(multipleCutOffPanel.getBottomLimTextField().getText()) / conversionFactor)); multipleCutOffPanel.getTopLimTextField() .setText("" + AnalysisUtils.roundTwoDecimals( Double.parseDouble(multipleCutOffPanel.getTopLimTextField().getText()) / conversionFactor)); } int topLimit = (int) (Double.parseDouble(multipleCutOffPanel.getTopLimTextField().getText()) * 10); int bottomLimit = (int) (Double.parseDouble(multipleCutOffPanel.getBottomLimTextField().getText()) * 10); double step = Double.parseDouble(multipleCutOffPanel.getTranslocationStepTextField().getText()); percentageMotile = Double .parseDouble(multipleCutOffPanel.getPercentageMotileStepsTextField().getText()); int numberSteps = (int) ((topLimit - bottomLimit) / (10 * step)) + 1; motileSteps = new ArrayList<>(); for (int i = 0; i < numberSteps; i++) { motileSteps.add(((double) bottomLimit / 10) + (step * i)); } FilterSwingWorker filterSwingWorker = new FilterSwingWorker(); filterSwingWorker.execute(); } catch (NumberFormatException ex) { // warn the user and log the error for info filteringController.showMessage("Please insert valid numbers!" + "\n " + ex.getMessage(), "number format exception", JOptionPane.ERROR_MESSAGE); LOG.error(ex.getMessage()); } }); // apply a specific cut-off value to all the conditions at once multipleCutOffPanel.getApplyCutOffToConditionsButton().addActionListener((ActionEvent e) -> { // get the cut-off from the list (sure this is a Double) Double value = (Double) multipleCutOffPanel.getCutOffValuesComboBox().getSelectedItem(); FilterConditionSwingWorker filterConditionSwingWorker = new FilterConditionSwingWorker(value); filterConditionSwingWorker.execute(); }); // select cut-off for a condition multipleCutOffPanel.getSelectCutOffForConditionButton().addActionListener((ActionEvent e) -> { if (multipleCutOffPanel.getCutOffValuesComboBox().getSelectedItem() != null) { SelectCutOffConditionSwingWorker selectCutOffConditionSwingWorker = new SelectCutOffConditionSwingWorker(); selectCutOffConditionSwingWorker.execute(); } else { filteringController.showMessage("Please select a cut-off!", "info", JOptionPane.WARNING_MESSAGE); } }); AlignedTableRenderer alignedTableRenderer = new AlignedTableRenderer(SwingConstants.LEFT); for (int i = 0; i < multipleCutOffPanel.getFilterTrackTable().getColumnModel().getColumnCount(); i++) { multipleCutOffPanel.getFilterTrackTable().getColumnModel().getColumn(i) .setCellRenderer(alignedTableRenderer); multipleCutOffPanel.getSummaryTable().getColumnModel().getColumn(i) .setCellRenderer(alignedTableRenderer); } multipleCutOffPanel.getFilterTrackTable().getTableHeader() .setDefaultRenderer(new TableHeaderRenderer(SwingConstants.LEFT)); multipleCutOffPanel.getSummaryTable().getTableHeader() .setDefaultRenderer(new TableHeaderRenderer(SwingConstants.LEFT)); // add view to parent component filteringController.getFilteringPanel().getMultipleCutOffParentPanel().add(multipleCutOffPanel, gridBagConstraints); }
From source file:com.ejie.uda.jsonI18nEditor.Editor.java
public void showWarning(String title, String message) { showMessageDialog(title, message, JOptionPane.WARNING_MESSAGE); }
From source file:net.sf.keystore_explorer.gui.dialogs.DViewCertCsrPem.java
private void exportPressed() { File chosenFile = null;//from w w w . j av a 2 s . c om FileWriter fw = null; String title; if (cert != null) { title = res.getString("DViewCertCsrPem.ExportPemCertificate.Title"); } else { title = res.getString("DViewCertCsrPem.ExportPemCsr.Title"); } try { String certPem = jtaPem.getText(); JFileChooser chooser = FileChooserFactory.getX509FileChooser(); chooser.setCurrentDirectory(CurrentDirectory.get()); chooser.setDialogTitle(title); chooser.setMultiSelectionEnabled(false); int rtnValue = JavaFXFileChooser.isFxAvailable() ? chooser.showSaveDialog(this) : chooser.showDialog(this, res.getString("DViewCertCsrPem.ChooseExportFile.button")); if (rtnValue != JFileChooser.APPROVE_OPTION) { return; } chosenFile = chooser.getSelectedFile(); CurrentDirectory.updateForFile(chosenFile); if (chosenFile.isFile()) { String message = MessageFormat.format(res.getString("DViewCertCsrPem.OverWriteFile.message"), chosenFile); int selected = JOptionPane.showConfirmDialog(this, message, title, JOptionPane.YES_NO_OPTION); if (selected != JOptionPane.YES_OPTION) { return; } } fw = new FileWriter(chosenFile); fw.write(certPem); } catch (FileNotFoundException ex) { JOptionPane.showMessageDialog(this, MessageFormat.format(res.getString("DViewCertCsrPem.NoWriteFile.message"), chosenFile), title, JOptionPane.WARNING_MESSAGE); return; } catch (Exception ex) { DError.displayError(this, ex); return; } finally { IOUtils.closeQuietly(fw); } JOptionPane.showMessageDialog(this, res.getString("DViewCertCsrPem.ExportPemCertificateSuccessful.message"), title, JOptionPane.INFORMATION_MESSAGE); }
From source file:edu.gmu.cs.sim.util.media.chart.ChartGenerator.java
/** Stops a Quicktime movie and cleans up, flushing the remaining frames out to disk. This method ought to be called from the main event loop. */ public void stopMovie() { if (movieMaker == null) { return; // already stopped }/* ww w . j av a 2s .co m*/ if (!movieMaker.stop()) { Object[] options = { "Drat" }; JOptionPane.showOptionDialog(this, "Your movie did not write to disk\ndue to a spurious JMF movie generation bug.", "JMF Movie Generation Bug", JOptionPane.OK_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[0]); } movieMaker = null; if (movieButton != null) // hasn't been destroyed yet { movieButton.setText("Create Movie"); } }
From source file:userinterface.EnvironmentRole.PollutionCheckJPanel.java
private void btnSetFineActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSetFineActionPerformed int selectedRow = tableCarOwners.getSelectedRow(); if (selectedRow < 0) { JOptionPane.showMessageDialog(null, "Please select a row from the table first", "Warning", JOptionPane.WARNING_MESSAGE); return;/* w ww.j av a 2 s . c om*/ } else { WorkRequest workRequest = (WorkRequest) tableCarOwners.getValueAt(selectedRow, 3); try { int oldFine = ((EnvironmentWorkRequest) workRequest).getFine(); ((EnvironmentWorkRequest) workRequest).setFine(oldFine + Integer.parseInt(textFine.getText())); // ArrayList<Employee,int> sdfdsf; Fine fine = new Fine(); Date date = new Date(); fine.setDate(date); fine.setFineIncurred(Integer.parseInt(textFine.getText())); fine.setUserAccount(((EnvironmentWorkRequest) workRequest).getSender()); environmentOrganization.getFineHistory().getFineIncurredhistory().add(fine); JOptionPane.showMessageDialog(null, "FIne Charged", "Success", JOptionPane.INFORMATION_MESSAGE); } catch (Exception e) { JOptionPane.showMessageDialog(null, "Enter a valid number", "Erroe", JOptionPane.ERROR_MESSAGE); } } }
From source file:com.ejie.uda.jsonI18nEditor.Editor.java
public boolean showConfirmation(String title, String message) { return showConfirmDialog(title, message, JOptionPane.WARNING_MESSAGE); }