List of usage examples for javax.swing JOptionPane OK_OPTION
int OK_OPTION
To view the source code for javax.swing JOptionPane OK_OPTION.
Click Source Link
From source file:br.com.postalis.folhapgto.proc.TelaPrincipal.java
private void btnImportarIncorporadasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnImportarIncorporadasActionPerformed carregarParametros();// w w w .j a va 2 s. c om int confirmacao = JOptionPane.showConfirmDialog(null, "Importar rubricas incorporadas na ECT para a referncia: " + txtMesAno + "?", "Importao de incorporadas", JOptionPane.OK_CANCEL_OPTION); if (confirmacao == JOptionPane.OK_OPTION) { new Thread() { public void run() { try { txtStatusProc .setText("Executando importao de rubricas incorporadas na ECT para a referncia: " + txtMesAno + "..."); btnImportarIncorporadas.setEnabled(false); ExitStatus retorno = new SvcFolhaPgtoImpl().consultarRubricasIncorporadas(usuario, anoMesRef, dtRef); if (retorno.equals(EnumExistStatus.VAZIO.getStatus())) { txtStatusProc .setText("No exitem lanamentos a importar na referncia: " + txtMesAno + "."); Thread.sleep(10000); txtStatusProc.setText(""); } else if (retorno.equals(EnumExistStatus.SUCESSO.getStatus())) { txtStatusProc.setText( "Importao concluida com sucesso para a referncia: " + txtMesAno + "."); Thread.sleep(10000); txtStatusProc.setText(""); } else { throw new Exception("O tipo de resultado no esperado: " + retorno.getExitCode()); } } catch (Exception ex) { String msg = "Erro ao executar a importao das rubricas incorporadas para a referncia: " + txtMesAno + ": "; LOGGER.error(msg + ex.getMessage()); txtStatusProc.setText(msg); } finally { btnImportarIncorporadas.setEnabled(true); preencherTabela(); } } }.start(); } }
From source file:frames.consulta.java
private void btneliminarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btneliminarActionPerformed int filase = tblconsulta.getSelectedRow(); try {//from ww w. j a v a 2 s .c o m String cedula, nombre, ape, edad, direccion; if (filase == -1) { JOptionPane.showMessageDialog(null, "Debe Seleccionar un Paciente", "Advertencia", JOptionPane.WARNING_MESSAGE); } else { int valor = JOptionPane.showConfirmDialog(this, "Esta Seguro eliminar el paciente?", "Advertencia", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE); if (valor == JOptionPane.YES_NO_OPTION) { JPasswordField pf = new JPasswordField(); int okCxl = JOptionPane.showConfirmDialog(null, pf, "Enter Password", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE); if (okCxl == JOptionPane.OK_OPTION) { String password = new String(pf.getPassword()); String cap = "", cap1 = ""; int id; String encriptado = DigestUtils.md5Hex(password); String sql = ""; sql = "SELECT * FROM administrador WHERE clave='" + encriptado + "'"; try { Statement st = cn.createStatement(); ResultSet rs = st.executeQuery(sql); while (rs.next()) { id = rs.getInt("id_usuario"); cap = rs.getString("usuario"); cap1 = rs.getString("clave"); } if (cap1.equals(encriptado)) { 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(); Eliminar(cedula); } else { JOptionPane.showMessageDialog(null, "Clave Invalida", "Advertencia", JOptionPane.WARNING_MESSAGE); } } catch (SQLException ex) { JOptionPane.showMessageDialog(null, ex); ; } //System.err.println("You entered: " + password); } //System.exit(0); } } } catch (Exception e) { //registro.action = "Ver"; } }
From source file:junk.gui.HazardDataSetCalcCondorApp.java
void imgLabel_mouseClicked(MouseEvent e) { try {//w w w . j ava 2s. c o m this.getAppletContext().showDocument(new URL(OPENSHA_WEBSITE), "new_peer_win"); } catch (java.net.MalformedURLException ee) { JOptionPane.showMessageDialog(this, new String("No Internet Connection Available"), "Error Connecting to Internet", JOptionPane.OK_OPTION); } }
From source file:com.net2plan.gui.utils.viewEditTopolTables.specificTables.AdvancedJTable_multicastDemand.java
private List<JComponent> getExtraOptions(final int row, final Object itemId) { List<JComponent> options = new LinkedList<JComponent>(); final int numRows = model.getRowCount(); final NetPlan netPlan = callback.getDesign(); final List<MulticastDemand> visibleRows = getVisibleElementsInTable(); JMenuItem offeredTrafficToAll = new JMenuItem("Set offered traffic to all"); offeredTrafficToAll.addActionListener(new ActionListener() { @Override/*w w w . j ava 2 s . co m*/ public void actionPerformed(ActionEvent e) { double h_d; while (true) { String str = JOptionPane.showInputDialog(null, "Offered traffic volume", "Set traffic value to all table multicast demands", JOptionPane.QUESTION_MESSAGE); if (str == null) return; try { h_d = Double.parseDouble(str); if (h_d < 0) throw new RuntimeException(); break; } catch (Throwable ex) { ErrorHandling.showErrorDialog( "Non-valid multicast demand offered traffic value. Please, introduce a non-negative number", "Error setting link length"); } } try { for (MulticastDemand demand : visibleRows) demand.setOfferedTraffic(h_d); callback.updateVisualizationAfterChanges( Collections.singleton(NetworkElementType.MULTICAST_DEMAND)); callback.getUndoRedoNavigationManager().addNetPlanChange(); } catch (Throwable ex) { ErrorHandling.showErrorDialog(ex.getMessage(), "Unable to set offered traffic to all multicast demands"); } } }); options.add(offeredTrafficToAll); if (itemId != null && netPlan.isMultilayer()) { final long demandId = (long) itemId; final MulticastDemand demand = netPlan.getMulticastDemandFromId(demandId); if (demand.isCoupled()) { JMenuItem decoupleDemandItem = new JMenuItem("Decouple multicast demand"); decoupleDemandItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { demand.decouple(); model.setValueAt("", row, COLUMN_COUPLEDTOLINKS); callback.getVisualizationState().resetPickedState(); callback.updateVisualizationAfterChanges( Sets.newHashSet(NetworkElementType.MULTICAST_DEMAND, NetworkElementType.LINK)); callback.getUndoRedoNavigationManager().addNetPlanChange(); } }); options.add(decoupleDemandItem); } if (numRows > 1) { JMenuItem decoupleAllDemandsItem = null; JMenuItem createUpperLayerLinksFromDemandsItem = null; final Set<MulticastDemand> coupledDemands = visibleRows.stream().filter(e -> e.isCoupled()) .collect(Collectors.toSet()); if (!coupledDemands.isEmpty()) { decoupleAllDemandsItem = new JMenuItem("Decouple all table demands"); decoupleAllDemandsItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { for (MulticastDemand d : coupledDemands) d.decouple(); int numRows = model.getRowCount(); for (int i = 0; i < numRows; i++) model.setValueAt("", i, COLUMN_COUPLEDTOLINKS); callback.getVisualizationState().resetPickedState(); callback.updateVisualizationAfterChanges( Sets.newHashSet(NetworkElementType.MULTICAST_DEMAND, NetworkElementType.LINK)); callback.getUndoRedoNavigationManager().addNetPlanChange(); } }); } if (coupledDemands.size() < visibleRows.size()) { createUpperLayerLinksFromDemandsItem = new JMenuItem( "Create upper layer links from uncoupled demands"); createUpperLayerLinksFromDemandsItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { List<Long> layerIds = netPlan.getNetworkLayerIds(); final JComboBox layerSelector = new WiderJComboBox(); for (long layerId : layerIds) { if (layerId == netPlan.getNetworkLayerDefault().getId()) continue; final String layerName = netPlan.getNetworkLayerFromId(layerId).getName(); String layerLabel = "Layer " + layerId; if (!layerName.isEmpty()) layerLabel += " (" + layerName + ")"; layerSelector.addItem(StringLabeller.of(layerId, layerLabel)); } layerSelector.setSelectedIndex(0); JPanel pane = new JPanel(); pane.add(new JLabel("Select layer: ")); pane.add(layerSelector); while (true) { int result = JOptionPane.showConfirmDialog(null, pane, "Please select the upper layer to create links", JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); if (result != JOptionPane.OK_OPTION) return; try { long layerId = (long) ((StringLabeller) layerSelector.getSelectedItem()) .getObject(); NetworkLayer layer = netPlan.getNetworkLayerFromId(layerId); for (MulticastDemand demand : visibleRows) if (!demand.isCoupled()) demand.coupleToNewLinksCreated(layer); callback.getVisualizationState() .recomputeCanvasTopologyBecauseOfLinkOrNodeAdditionsOrRemovals(); callback.updateVisualizationAfterChanges(Sets.newHashSet( NetworkElementType.MULTICAST_DEMAND, NetworkElementType.LINK)); callback.getUndoRedoNavigationManager().addNetPlanChange(); break; } catch (Throwable ex) { ErrorHandling.showErrorDialog(ex.getMessage(), "Error creating upper layer links"); } } } }); } if (!options.isEmpty() && (decoupleAllDemandsItem != null || createUpperLayerLinksFromDemandsItem != null)) { options.add(new JPopupMenu.Separator()); if (decoupleAllDemandsItem != null) options.add(decoupleAllDemandsItem); if (createUpperLayerLinksFromDemandsItem != null) options.add(createUpperLayerLinksFromDemandsItem); } } } return options; }
From source file:co.com.soinsoftware.hotelero.view.JFRoomService.java
private void jbtAddServiceActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_jbtAddServiceActionPerformed if (this.validateDataForSave()) { final int confirmation = ViewUtils.showConfirmDialog(this, ViewUtils.MSG_SAVE_QUESTION, ViewUtils.TITLE_SAVED);//from w ww.ja v a 2 s.c om if (confirmation == JOptionPane.OK_OPTION) { final Invoice invoice = this.getInvoiceSelected(); final Date invoiceItemDate = this.jdcInitialDate.getDate(); final Service service = this.getServiceSelected(); final int quantity = this.getServiceQuantity(); final long unitValue = this.getServiceValue(); final long value = quantity * unitValue; invoiceItemController.save(invoice, service, quantity, unitValue, value, invoiceItemDate); final long invoiceValue = value + invoice.getValue(); invoice.setValue(invoiceValue); invoice.setUpdated(new Date()); this.invoiceController.save(invoice); ViewUtils.showMessage(this, ViewUtils.MSG_SAVED, ViewUtils.TITLE_SAVED, JOptionPane.INFORMATION_MESSAGE); this.refreshService(); } } }
From source file:org.gumtree.vis.awt.time.TimePlotPanel.java
@Override public void doEditChartProperties() { if (selectedDataset != null && selectedSeriesIndex >= 0) { Plot1DChartEditor.setSuggestedSeriesKey((String) selectedDataset.getSeriesKey(selectedSeriesIndex)); }//ww w .j av a2 s.c o m TimePlotChartEditor editor = new TimePlotChartEditor(getChart()); int result = JOptionPane.showConfirmDialog(this, editor, localizationResources.getString("Chart_Properties"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE); if (result == JOptionPane.OK_OPTION) { editor.updateChart(getChart()); updatePlot(); } }
From source file:com.mirth.connect.client.ui.ChannelPanel.java
public void doDeployChannel() { List<Channel> selectedChannels = getSelectedChannels(); if (selectedChannels.size() == 0) { parent.alertWarning(parent, "Channel no longer exists."); return;/*w w w .j av a2s .co m*/ } // Only deploy enabled channels final Set<String> selectedEnabledChannelIds = new LinkedHashSet<String>(); boolean channelDisabled = false; for (Channel channel : selectedChannels) { if (channel.isEnabled()) { selectedEnabledChannelIds.add(channel.getId()); } else { channelDisabled = true; } } if (channelDisabled) { parent.alertWarning(parent, "Disabled channels will not be deployed."); } // If there are any channel dependencies, decide if we need to warn the user on deploy. try { ChannelDependencyGraph channelDependencyGraph = new ChannelDependencyGraph(channelDependencies); Set<String> deployedChannelIds = new HashSet<String>(); if (parent.status != null) { for (DashboardStatus dashboardStatus : parent.status) { deployedChannelIds.add(dashboardStatus.getChannelId()); } } // For each selected channel, add any dependent/dependency channels as necessary Set<String> channelIdsToDeploy = new HashSet<String>(); for (String channelId : selectedEnabledChannelIds) { addChannelToDeploySet(channelId, channelDependencyGraph, deployedChannelIds, channelIdsToDeploy); } // If additional channels were added to the set, we need to prompt the user if (!CollectionUtils.subtract(channelIdsToDeploy, selectedEnabledChannelIds).isEmpty()) { ChannelDependenciesWarningDialog dialog = new ChannelDependenciesWarningDialog(ChannelTask.DEPLOY, channelDependencies, selectedEnabledChannelIds, channelIdsToDeploy); if (dialog.getResult() == JOptionPane.OK_OPTION) { if (dialog.isIncludeOtherChannels()) { selectedEnabledChannelIds.addAll(channelIdsToDeploy); } } else { return; } } } catch (ChannelDependencyException e) { // Should never happen e.printStackTrace(); } parent.deployChannel(selectedEnabledChannelIds); }
From source file:com.sec.ose.osi.ui.frm.main.identification.stringmatch.JPanStringMatchMain.java
public UEStringMatch exportUIEntity(String projectName) { String stringSearch = ""; String componentName = ""; String versionName = ""; String licenseName = ""; String newComponentName = ""; String newVersionName = ""; String newLicenseName = getSelectedLicenseName(); log.debug("exportUIEntity - "); SelectedFilePathInfo selectedPaths = IdentifyMediator.getInstance().getSelectedFilePathInfo(); JTableMatchedInfoForSM jTableMatchedInfoForSM = jPanelTableCardLayout.getSelectedTable(); int row = jTableMatchedInfoForSM.getSelectedRow(); int pathType = selectedPaths.getPathType(); switch (pathType) { case SelectedFilePathInfo.SINGLE_FILE_TYPE: { stringSearch = String/*from w ww. j a va2s . c o m*/ .valueOf(jTableMatchedInfoForSM.getValueAt(row, TableModelForSMFile.COL_STRING_SEARCH)); componentName = String .valueOf(jTableMatchedInfoForSM.getValueAt(row, TableModelForSMFile.COL_COMPONENT_NAME)); versionName = String .valueOf(jTableMatchedInfoForSM.getValueAt(row, TableModelForSMFile.COL_VERSION_NAME)); licenseName = String .valueOf(jTableMatchedInfoForSM.getValueAt(row, TableModelForSMFile.COL_LICENSE_NAME)); } break; case SelectedFilePathInfo.MULTIPLE_FILE_TYPE: { } break; case SelectedFilePathInfo.FOLDER_TYPE: case SelectedFilePathInfo.PROJECT_TYPE: { stringSearch = String .valueOf(jTableMatchedInfoForSM.getValueAt(row, TableModelForSMFolder.COL_STRING_SEARCH)); componentName = String .valueOf(jTableMatchedInfoForSM.getValueAt(row, TableModelForSMFolder.COL_COMPONENT_NAME)); versionName = String .valueOf(jTableMatchedInfoForSM.getValueAt(row, TableModelForSMFolder.COL_VERSION_NAME)); licenseName = String .valueOf(jTableMatchedInfoForSM.getValueAt(row, TableModelForSMFile.COL_LICENSE_NAME)); } break; } if (stringSearch.equals("null")) stringSearch = ""; if (componentName.equals("null")) componentName = ""; if (versionName.equals("null")) versionName = ""; if (licenseName.equals("null")) licenseName = ""; String status = String.valueOf(jTableMatchedInfoForSM.getValueAt(row, TableModelForSMFile.COL_STATUS)); if (opt1ThisFileIs.isSelected()) { if (("Pending".equals(status)) && (getSelectedLicenseName() == null || getSelectedLicenseName().length() <= 0)) { JOptionPane.showOptionDialog(null, "\"License\" Field must be non-empty.", "Pending identification", JOptionPane.OK_OPTION, JOptionPane.ERROR_MESSAGE, null, buttonOK, "OK"); return null; } if ((getSelectedComponentName()).length() > 0) { newComponentName = getSelectedComponentName(); } else { newComponentName = "DECLARED_STRING_MATCH_LICENSE_" + newLicenseName; } } else if (opt2ThisFileContains.isSelected()) { if (("Pending".equals(status)) && (getSelectedLicenseName() == null || getSelectedLicenseName().length() <= 0)) { JOptionPane.showOptionDialog(null, "\"Representative License\" Field must be non-empty.", "Pending identification", JOptionPane.OK_OPTION, JOptionPane.ERROR_MESSAGE, null, buttonOK, "OK"); return null; } newComponentName = "DECLARED_STRING_MATCH_MULTIPLE_LICENSE_" + newLicenseName; } log.debug("exportUIEntity - newComponentName : " + newComponentName); UEStringMatch xUEStringMatch = new UEStringMatch(stringSearch, componentName, versionName, licenseName, newComponentName, newVersionName, newLicenseName); return xUEStringMatch; }
From source file:br.com.postalis.folhapgto.proc.TelaPrincipal.java
private void btnImportarLogActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnImportarLogActionPerformed carregarParametros();/*from ww w . j av a 2s . co m*/ int confirmacao = JOptionPane.showConfirmDialog(null, "Importar Log de processamento ECT para a referncia: " + txtMesAno + "?", "Importao do log de processamento", JOptionPane.OK_CANCEL_OPTION); if (confirmacao == JOptionPane.OK_OPTION) { new Thread() { public void run() { try { txtStatusProc .setText("Executando importao do log de processamento ECT para a referncia: " + txtMesAno + "..."); btnImportarLog.setEnabled(false); ExitStatus retorno = new SvcFolhaPgtoImpl().consultarLogImportacao(usuario, anoMesRef, dtRef); if (retorno.equals(EnumExistStatus.VAZIO.getStatus())) { txtStatusProc .setText("No exitem lanamentos a importar na referncia: " + txtMesAno + "."); Thread.sleep(10000); txtStatusProc.setText(""); } else if (retorno.equals(EnumExistStatus.SUCESSO.getStatus())) { txtStatusProc.setText( "Importao concluida com sucesso para a referncia: " + txtMesAno + "."); Thread.sleep(10000); txtStatusProc.setText(""); } else { throw new Exception("O tipo de resultado no esperado: " + retorno.getExitCode()); } } catch (Exception ex) { String msg = "Erro ao executar a importao do log de processamento para a referncia: " + txtMesAno + ":"; LOGGER.error(msg + ex.getMessage()); txtStatusProc.setText(msg); } finally { btnImportarLog.setEnabled(true); } } }.start(); } }
From source file:gui.DownloadManagerGUI.java
@Override public void actionPerformed(ActionEvent e) { JMenuItem clicked = (JMenuItem) e.getSource(); if (clicked == exportDataItem) { // addNewDownloadDialog.setVisible(true); } else if (clicked == importDataItem) { // addNewDownloadDialog.setVisible(true); } else if (clicked == exitItem) { WindowListener[] listeners = getWindowListeners(); for (WindowListener listener : listeners) listener.windowClosing(new WindowEvent(DownloadManagerGUI.this, 0)); } else if (clicked == prefsItem) { preferenceDialog.setVisible(true); } else if (clicked == newDownloadItem) { addNewDownloadDialog.setVisible(true); addNewDownloadDialog.onPaste();/*ww w . ja v a2s .c o m*/ } else if (clicked == openItem) { downloadPanel.actionOpenFile(); } else if (clicked == openFolderItem) { downloadPanel.actionOpenFolder(); } else if (clicked == resumeItem) { downloadPanel.actionResume(); } else if (clicked == pauseItem) { downloadPanel.actionPause(); mainToolbar.setStateOfButtonsControl(false, false, false, false, false, true); // canceled } else if (clicked == pauseAllItem) { int action = JOptionPane.showConfirmDialog(DownloadManagerGUI.this, "Do you realy want to pause all downloads?", "Confirm pause all", JOptionPane.OK_CANCEL_OPTION); ////*********** if (action == JOptionPane.OK_OPTION) { downloadPanel.actionPauseAll(); } } else if (clicked == clearItem) { downloadPanel.actionClear(); } else if (clicked == clearAllCompletedItem) { downloadPanel.actionClearAllCompleted(); } else if (clicked == reJoinItem) { downloadPanel.actionReJoinFileParts(); } else if (clicked == reDownloadItem) { downloadPanel.actionReDownload(); } else if (clicked == moveToQueueItem) { // mainToolbarListener.preferencesEventOccured(); } else if (clicked == removeFromQueueItem) { // mainToolbarListener.preferencesEventOccured(); } else if (clicked == propertiesItem) { downloadPanel.actionProperties(); } else if (clicked == aboutItem) { if (!aboutDialog.isVisible()) aboutDialog.setVisible(true); } }