List of usage examples for javax.swing JOptionPane NO_OPTION
int NO_OPTION
To view the source code for javax.swing JOptionPane NO_OPTION.
Click Source Link
From source file:es.darkhogg.hazelnutt.EditorFrame.java
protected boolean checkRomModified() { if (!checkLevelModified()) { return false; }/*from w ww.j a va 2 s. c o m*/ if (romHasChanged) { int res = JOptionPane.showConfirmDialog(this, "The currently open ROM has modified levels but is not saved to disk.\n" + "Do you want to save it now?", "Confirm ROM Changes", JOptionPane.YES_NO_CANCEL_OPTION); if (res == JOptionPane.YES_OPTION) { actionSaveRom(); } else if (res == JOptionPane.NO_OPTION) { } else { return false; } } updateTitle(); return true; }
From source file:es.darkhogg.hazelnutt.EditorFrame.java
private boolean checkLevelModified() { if (!checkPropertiesModified()) { return false; }/*w w w .ja v a 2 s. c om*/ if (levelHasChanged) { int res = JOptionPane.showConfirmDialog(this, "The currently selected level has changed but not saved to the ROM.\n" + "Do you want to save it now?", "Confirm Level Changes", JOptionPane.YES_NO_CANCEL_OPTION); if (res == JOptionPane.YES_OPTION) { loadedRom.setLevel(selectedLevelNum, selectedLevel); levelHasChanged = false; romHasChanged = true; } else if (res == JOptionPane.NO_OPTION) { } else { return false; } } updateTitle(); return true; }
From source file:es.darkhogg.hazelnutt.EditorFrame.java
private boolean checkPropertiesModified() { if (propertiesPanel.hasChanged()) { int res = JOptionPane.showConfirmDialog(this, "Properties for this level were changed but not applied.\n" + "Do you want to apply them now?", "Confirm Properties Changes", JOptionPane.YES_NO_CANCEL_OPTION); if (res == JOptionPane.YES_OPTION) { propertiesPanel.actionApply(); } else if (res == JOptionPane.NO_OPTION) { propertiesPanel.actionReset(); } else {/*from w w w . jav a2 s. c o m*/ return false; } } updateTitle(); return true; }
From source file:edu.ku.brc.specify.tasks.QueryTask.java
/** * @param q/*from w ww .j av a2s . c om*/ * @param session * @return true if q has no associated reports or user confirms delete * @throws Exception */ protected boolean okToDeleteQuery(final SpQuery q, DataProviderSessionIFace session) throws Exception { //assumes q is force-loaded if (q.getReports().size() > 0) { CustomDialog cd = new CustomDialog((Frame) UIRegistry.getTopWindow(), UIRegistry.getResourceString("REP_CONFIRM_DELETE_TITLE"), true, CustomDialog.OKHELP, new QBReportInfoPanel(q, UIRegistry.getResourceString("QB_UNDELETABLE_REPS"))); cd.setHelpContext("QBUndeletableReps"); UIHelper.centerAndShow(cd); cd.dispose(); return false; } int option = JOptionPane.showOptionDialog(UIRegistry.getMostRecentWindow(), String.format(UIRegistry.getResourceString("REP_CONFIRM_DELETE"), q.getName()), UIRegistry.getResourceString("REP_CONFIRM_DELETE_TITLE"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, JOptionPane.NO_OPTION); return option == JOptionPane.YES_OPTION; }
From source file:edu.ku.brc.specify.tasks.RecordSetTask.java
/** * Processes all Commands of type RECORD_SET. * @param cmdAction the command to be processed *//*from w w w .j a v a 2s . c om*/ protected void processRecordSetCommands(final CommandAction cmdAction) { if (cmdAction.isAction(SAVE_RECORDSET)) { Object data = cmdAction.getData(); if (data instanceof RecordSetIFace) { // If there is only one item in the RecordSet then the User will most likely want it named the same // as the "identity" of the data object. So this goes and gets the Identity name and // pre-sets the name in the dialog. String intialName = ""; RecordSetIFace recordSet = (RecordSetIFace) cmdAction.getData(); if (recordSet.getNumItems() == 1) { RecordSetItemIFace item = recordSet.getOrderedItems().iterator().next(); DataProviderSessionIFace session = DataProviderFactory.getInstance().createSession(); String sqlStr = DBTableIdMgr.getInstance().getQueryForTable(recordSet.getDbTableId(), item.getRecordId()); if (StringUtils.isNotEmpty(sqlStr)) { Object dataObj = session.getData(sqlStr); if (dataObj != null) { intialName = ((FormDataObjIFace) dataObj).getIdentityTitle(); } } session.close(); } String rsName = getUniqueRecordSetName(intialName); if (isNotEmpty(rsName)) { RecordSet rs = (RecordSet) data; rs.setName(rsName); rs.setModifiedByAgent(Agent.getUserAgent()); saveNewRecordSet(rs); } } } else if (cmdAction.isAction(DELETE_CMD_ACT)) { RecordSetIFace recordSet = null; if (cmdAction.getData() instanceof RecordSetIFace) { recordSet = (RecordSetIFace) cmdAction.getData(); } else if (cmdAction.getData() instanceof RolloverCommand) { RolloverCommand roc = (RolloverCommand) cmdAction.getData(); if (roc.getData() instanceof RecordSetIFace) { recordSet = (RecordSetIFace) roc.getData(); } } if (recordSet != null) { int option = JOptionPane.showOptionDialog(UIRegistry.getMostRecentWindow(), String.format(UIRegistry.getResourceString("RecordSetTask.CONFIRM_DELETE"), recordSet.getName()), UIRegistry.getResourceString("RecordSetTask.CONFIRM_DELETE_TITLE"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, JOptionPane.NO_OPTION); // I18N if (option == JOptionPane.YES_OPTION) { deleteRecordSet(recordSet); deleteRecordSetFromUI(null, recordSet); } } } else if (cmdAction.isAction("Dropped")) { mergeRecordSets(cmdAction.getSrcObj(), cmdAction.getDstObj()); } else if (cmdAction.isAction("AskForNewRS")) { createRecordSet((RecordSet) cmdAction.getSrcObj()); } else if (cmdAction.isAction("DELETEITEMS")) { processDeleteRSItems(cmdAction); } else if (cmdAction.isAction(ADD_TO_NAV_BOX)) { addToNavBox((RecordSet) cmdAction.getData()); } }
From source file:com.pianobakery.complsa.MainGui.java
public void addTopicCorpusMethod() { logger.debug("Numeric?: " + StringUtils.isNumeric(amountOfSentencesPerTextField.getText())); logger.debug("Chunk selected: " + createChunksCheckBox.isSelected()); if (createChunksCheckBox.isSelected() && !StringUtils.isNumeric(amountOfSentencesPerTextField.getText())) { JOptionPane.showMessageDialog(null, "Enter Number"); return;/* w ww . j a v a 2 s . com*/ } if (trainSentModels.size() == 0) { JOptionPane.showMessageDialog(null, "Download Sentence Models first"); return; } File folder = chooseAddCorpusFolder(); if (folder != null) { File newDir = new File(wDir + File.separator + topicFolder + File.separator + folder.getName()); logger.debug("Corpus Folder: " + folder.toString()); logger.debug("Import Folder: " + newDir.toString()); logger.debug("Working Folder : " + wDir.toString()); logger.debug("Corpus Folder recursive is: " + addCorpRecursiveCheckBox.isSelected()); //Create Corpus Folder if (!newDir.exists()) { logger.debug("Creating directory: " + newDir); boolean result = false; try { FileUtils.forceMkdir(newDir); addRemoveItemToTopicSearchBoxTaskWithBar(getProgressBarWithTitleLater("Please wait...", false), newDir, true, true); //addRemoveItemToTopicBox(newDir, true, true); result = true; } catch (SecurityException se) { JOptionPane.showMessageDialog(null, "No permission or File Exists"); //return Boolean.FALSE; } catch (IOException e1) { e1.printStackTrace(); } if (result) { logger.debug("DIR created"); } } else { int result = JOptionPane.showConfirmDialog(new JFrame(), "Folder exists, add to your Topic Corpus? You have to re-train!"); logger.debug("DIR not created"); if (result == JOptionPane.NO_OPTION | result == JOptionPane.CANCEL_OPTION) { return; } } //Run import if (folder != null) { addTopicCorpTaskWithBar(getProgressBarWithTitleLater("Add Topic Corpus", true), folder, newDir, addCorpRecursiveCheckBox.isSelected(), Integer.parseInt(amountOfSentencesPerTextField.getText()), createChunksCheckBox.isSelected()); } } }
From source file:generadorqr.jifrGestionArticulos.java
private void btnImprimirMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnImprimirMouseClicked /*if(jcbBuscarQrCategora.getSelectedIndex() != 0){ Object [] opciones={"ACEPTAR", "CANCELAR"}; int eleccion = JOptionPane.showOptionDialog(this, "Esta seguro de imprimir los QR por categoria", "Imprimir", JOptionPane.YES_NO_OPTION,/*w w w. j a v a 2 s . c o m*/ JOptionPane.QUESTION_MESSAGE, null, opciones, "Aceptar"); if(eleccion==JOptionPane.YES_OPTION){ ItemSeleccionado.accionBoton = "ImprimirXCategoria"; ImprimirQRs iqr = new ImprimirQRs(); iqr.setVisible(true); } }*/ Object[] opciones = { "TODOS LOS QR", "QR UNICO", "POR CATEGOR?A" }; int eleccion = JOptionPane.showOptionDialog(this, "Escoja el modo de impresin", "Imprimir", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, opciones, "Aceptar"); if (eleccion == JOptionPane.YES_OPTION) { ItemSeleccionado.accionBoton = "ImprimirTotal"; ImprimirQRs iqr = new ImprimirQRs(); iqr.setVisible(true); } else if (eleccion == JOptionPane.NO_OPTION) { if (!idA.isEmpty()) { ItemSeleccionado.accionBoton = "ImprimirParcial"; isA.setIdArticulo(idA); ImprimirQRs iqr = new ImprimirQRs(); iqr.setVisible(true); } else JOptionPane.showMessageDialog(this, "Busque y Seleccione un registro para imprimir"); } else { if (jcbBuscarQrCategora.getSelectedIndex() != 0) { ItemSeleccionado.accionBoton = "ImprimirXCategoria"; ImprimirQRs iqr = new ImprimirQRs(); iqr.setVisible(true); } else JOptionPane.showMessageDialog(this, "Seleccione una categora"); } LimpiarTablaEImagenes(); }
From source file:edu.ku.brc.specify.tasks.subpane.security.SecurityAdminPane.java
@Override public boolean aboutToShutdown() { boolean result = true; if (formHasChanged()) { String msg = String.format(getResourceString("SaveChanges"), getTitle()); JFrame topFrame = (JFrame) UIRegistry.getTopWindow(); int rv = JOptionPane.showConfirmDialog(topFrame, msg, getResourceString("SaveChangesTitle"), JOptionPane.YES_NO_CANCEL_OPTION); if (rv == JOptionPane.YES_OPTION) { doSave(false);/*from w w w . j a va 2 s . co m*/ } else if (rv == JOptionPane.CANCEL_OPTION || rv == JOptionPane.CLOSED_OPTION) { return false; } else if (rv == JOptionPane.NO_OPTION) { // nothing } } return result; }
From source file:com.pianobakery.complsa.MainGui.java
public void removeTopicCorpusMethod() { File theFile = trainCorp.get(selectTrainCorp.getSelectedItem()); int result = JOptionPane.showConfirmDialog(null, "Do you want to continue?", "Confirm", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (result == JOptionPane.NO_OPTION || result == JOptionPane.CANCEL_OPTION) { return;//from w w w .j av a 2 s .com } if (theFile != null) { addRemoveItemToTopicSearchBoxTaskWithBar(getProgressBarWithTitleLater("Please wait...", false), theFile, false, true); //addRemoveItemToTopicBox(theFile, false, true); //updateIndexFileFolder(); } else if (theFile == null) { try { selectTrainCorp.removeItemAt(0); System.out.printf("Items of selectTrainingCorp: " + selectTrainCorp.getItemAt(0)); try { updateIndexFileFolder(); } catch (IOException e1) { e1.printStackTrace(); } } catch (ArrayIndexOutOfBoundsException e2) { JOptionPane.showMessageDialog(null, "Keine Topic Corps mehr vorhanden"); } } }
From source file:ElectionGUI.java
private void loadElectionBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_loadElectionBtnActionPerformed if (!generalPreferencesCheckBox.isSelected()) { //Confirmation of discarding an election2D that is not saved boolean discard = true; if (election2D != null && !saved) { int response = JOptionPane.showConfirmDialog(null, "Current " + "election is not saved, are you sure you want to load " + "an election?" + eol + "Press \"No\" to save current " + "election in a file.", "Confirm", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (response == JOptionPane.NO_OPTION) { discard = false;// w ww . j ava 2 s .co m } } if (discard) { JFileChooser fileChooser = new JFileChooser(); fileChooser.setCurrentDirectory(folder); int result = fileChooser.showOpenDialog(this); if (result == JFileChooser.APPROVE_OPTION) { folder = fileChooser.getCurrentDirectory(); File selectedFile = fileChooser.getSelectedFile(); Parse2dElection parser = new Parse2dElection(); parser.parseFromFile(selectedFile); if (parser.getErr() == null) { election2D = parser.getElection(); nTxtField.setText(String.valueOf(election2D.getNumberOfVoters())); mTxtField.setText(String.valueOf(election2D.getNumberOfCandidates())); kTxtField.setText(String.valueOf(election2D.getCommitteeSize())); xLimit = parser.getxLimit(); xLimitTxtField.setText(String.valueOf(xLimit)); yLimit = parser.getyLimit(); yLimitTxtField.setText(String.valueOf(yLimit)); nClusters = parser.getnClusters(); nClusterTxtField.setText(String.valueOf(nClusters)); mClusters = parser.getmClusters(); mClusterTxtField.setText(String.valueOf(mClusters)); systemTxt.append("-Election loaded." + eol); plotResultsBtn.setEnabled(true); saveElectionBtn.setEnabled(true); consistencyBtn.setEnabled(false); saved = true; } else { systemTxt.append(parser.getErr() + eol); } } else if (result == JFileChooser.CANCEL_OPTION) { systemTxt.append("-Loading cancelled." + eol); } } } else { JFileChooser fileChooser = new JFileChooser(); fileChooser.setCurrentDirectory(folder); int result = fileChooser.showOpenDialog(this); if (result == JFileChooser.APPROVE_OPTION) { folder = fileChooser.getCurrentDirectory(); File selectedFile = fileChooser.getSelectedFile(); ParseGeneralElection parser = new ParseGeneralElection(); parser.parseFromFile(selectedFile); if (parser.getErr() == null) { ArrayList<Voter> voters = parser.getVoters(); ArrayList<Candidate> candidates = parser.getCandidates(); n = voters.size(); m = candidates.size(); try { int x = Integer.parseInt(kTxtField.getText()); if (x < 1 || x > 100 || x > m) { throw (new Exception()); } k = x; } catch (Exception e) { kTxtField.setBackground(Color.cyan); kTxtField.setText("1"); k = 1; systemTxt.append("-Committee size was invalid. It has " + "been set equal to 1." + eol); } electionGP = new Election(k, voters, candidates, false); plotResultsBtn.setEnabled(true); consistencyBtn.setEnabled(false); systemTxt .append("-Election " + selectedFile.getName() + " has been loaded successfully." + eol); } else { systemTxt.append(parser.getErr() + eol); } } else if (result == JFileChooser.CANCEL_OPTION) { systemTxt.append("-Loading cancelled." + eol); } } }