List of usage examples for javax.swing JOptionPane YES_OPTION
int YES_OPTION
To view the source code for javax.swing JOptionPane YES_OPTION.
Click Source Link
From source file:com.proyecto.vista.MantenimientoArea.java
private void btnguardarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnguardarActionPerformed // TODO add your handling code here: List<Integer> array = new ArrayList(); array.add(FormularioUtil.Validar(FormularioUtil.TipoValidacion.NUMERO, this.nombreField, "Nombre")); FormularioUtil.validar2(array);//from w w w . j a v a 2 s .com if (FormularioUtil.error) { JOptionPane.showMessageDialog(null, FormularioUtil.mensaje, "Mensaje del Sistema", JOptionPane.ERROR_MESSAGE); FormularioUtil.mensaje = ""; FormularioUtil.error = false; } else { String palabra = ""; String palabra2 = ""; if (accion == 1) { palabra = "registrar"; palabra2 = "registrado"; if (JOptionPane.showConfirmDialog(null, "Desea " + palabra + " la Area?", "Mensaje del Sistema", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) { areaControlador.getSeleccionado().setNombre(nombreField.getText().toUpperCase()); areaControlador.accion(accion); lista.add(areaControlador.getSeleccionado()); if (accion == 1) { JOptionPane.showMessageDialog(null, "Area " + palabra2 + " correctamente", "Mensaje del Sistema", JOptionPane.INFORMATION_MESSAGE); FormularioUtil.limpiarComponente(panelDatos); } else { JOptionPane.showMessageDialog(null, "Area no " + palabra2, "Mensaje del Sistema", JOptionPane.ERROR_MESSAGE); } } else { FormularioUtil.limpiarComponente(panelDatos); JOptionPane.showMessageDialog(null, "Area no " + palabra2, "Mensaje del Sistema", JOptionPane.ERROR_MESSAGE); } } else if (accion == 2) { palabra = "modificar"; palabra2 = "modificado"; if (JOptionPane.showConfirmDialog(null, "Desea " + palabra + " la Area?", "Mensaje del Sistema", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) { if (accion == 2) { JOptionPane.showMessageDialog(null, "Area " + palabra2 + " correctamente", "Mensaje del Sistema", JOptionPane.INFORMATION_MESSAGE); lista.clear(); areaControlador.getSeleccionado().setNombre(nombreField.getText().toUpperCase()); areaControlador.accion(accion); listar(); FormularioUtil.limpiarComponente(panelDatos); } else { JOptionPane.showMessageDialog(null, "Area no " + palabra2, "Mensaje del Sistema", JOptionPane.ERROR_MESSAGE); } } else { FormularioUtil.limpiarComponente(panelDatos); JOptionPane.showMessageDialog(null, "Area no " + palabra2, "Mensaje del Sistema", JOptionPane.ERROR_MESSAGE); } } FormularioUtil.activarComponente(panelOpciones, true); FormularioUtil.activarComponente(panelGuardar, false); FormularioUtil.activarComponente(panelDatos, false); } }
From source file:org.gumtree.vis.awt.CompositePanel.java
/** * Opens a file chooser and gives the user an opportunity to save the chart * in PNG format./*from w w w .j av a2s. co m*/ * * @throws IOException if there is an I/O error. */ @Override public void doSaveAs() throws IOException { JFileChooser fileChooser = new JFileChooser(); String currentDirectory = System.getProperty(StaticValues.SYSTEM_SAVE_PATH_LABEL); if (currentDirectory != null) { File savePath = new File(currentDirectory); if (savePath.exists() && savePath.isDirectory()) { fileChooser.setCurrentDirectory(savePath); } } ExtensionFileFilter pngFilter = new ExtensionFileFilter("PNG_Image_Files", ".png"); ExtensionFileFilter jpgFilter = new ExtensionFileFilter("JPG_Image_Files", ".jpg"); fileChooser.addChoosableFileFilter(pngFilter); fileChooser.addChoosableFileFilter(jpgFilter); int option = fileChooser.showSaveDialog(this); if (option == JFileChooser.APPROVE_OPTION) { String filename = fileChooser.getSelectedFile().getPath(); String selectedDescription = fileChooser.getFileFilter().getDescription(); String fileExtension = StaticValues.DEFAULT_IMAGE_FILE_EXTENSION; if (selectedDescription.toLowerCase().contains("png")) { fileExtension = "png"; if (!filename.toLowerCase().endsWith(".png")) { filename = filename + ".png"; } } else if (selectedDescription.toLowerCase().contains("jpg")) { fileExtension = "jpg"; if (!filename.toLowerCase().endsWith(".jpg")) { filename = filename + ".jpg"; } } File selectedFile = new File(filename); int confirm = JOptionPane.YES_OPTION; if (selectedFile.exists()) { confirm = JOptionPane.showConfirmDialog(this, selectedFile.getName() + " exists, overwrite?", "Confirm Overwriting", JOptionPane.YES_NO_OPTION); } if (confirm == JOptionPane.YES_OPTION) { saveTo(filename, fileExtension); System.setProperty(StaticValues.SYSTEM_SAVE_PATH_LABEL, fileChooser.getSelectedFile().getParent()); } } }
From source file:com.holycityaudio.SpinCAD.SpinCADFile.java
public void fileSaveHex(SpinCADBank bank) { // Create a file chooser String savedPath = prefs.get("MRUHexFolder", ""); final JFileChooser fc = new JFileChooser(savedPath); FileNameExtensionFilter filter = new FileNameExtensionFilter("Hex Files", "hex"); fc.setFileFilter(filter);//from ww w.ja v a 2 s .co m fc.showSaveDialog(new JFrame()); File fileToBeSaved = fc.getSelectedFile(); if (!fc.getSelectedFile().getAbsolutePath().endsWith(".hex")) { fileToBeSaved = new File(fc.getSelectedFile() + ".hex"); } int n = JOptionPane.YES_OPTION; if (fileToBeSaved.exists()) { JFrame frame1 = new JFrame(); n = JOptionPane.showConfirmDialog(frame1, "Would you like to overwrite it?", "File already exists!", JOptionPane.YES_NO_OPTION); } if (n == JOptionPane.YES_OPTION) { String filePath; try { filePath = fileToBeSaved.getPath(); fileToBeSaved.delete(); } finally { } for (int i = 0; i < 8; i++) { try { if (bank.patch[i].isHexFile) { fileSaveHex(i, bank.patch[i].hexFile, filePath); } else { fileSaveHex(i, bank.patch[i].patchModel.getRenderBlock().generateHex(), filePath); } } catch (IOException e) { JOptionPane.showOptionDialog(null, "File save error!", "Error", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, null); e.printStackTrace(); } } saveMRUHexFolder(filePath); } }
From source file:com.tiempometa.muestradatos.JProgramTags.java
@Override public void handleReadings(List<TagReading> readings) { bibLabel.setText(""); if (readings.size() > 0) { if (readings.size() == 1) { statusLabel.setBackground(Color.cyan); statusLabel.setText("Leyendo tag"); for (TagReading tagReading : readings) { logger.info("Tag data dump"); logger.info(tagReading.getTagReadData().getTag().epcString()); logger.info(String.valueOf(tagReading.getTagReadData().getData().length)); logger.info(Hex.encodeHexString(tagReading.getTagReadData().getData())); logger.info(String.valueOf(tagReading.getTagReadData().getEPCMemData().length)); logger.info(Hex.encodeHexString(tagReading.getTagReadData().getEPCMemData())); logger.info(String.valueOf(tagReading.getTagReadData().getTIDMemData().length)); logger.info(Hex.encodeHexString(tagReading.getTagReadData().getTIDMemData())); logger.info(String.valueOf(tagReading.getTagReadData().getReservedMemData().length)); logger.info(Hex.encodeHexString(tagReading.getTagReadData().getReservedMemData())); logger.info(String.valueOf(tagReading.getTagReadData().getUserMemData().length)); logger.info(Hex.encodeHexString(tagReading.getTagReadData().getUserMemData())); if (tagReading.getTid() == null) { try { tagReading.setTid(ReaderContext.readTid(tagReading.getEpc(), 12)); if (logger.isDebugEnabled()) { logger.debug("Got tag " + tagReading.getEpc() + " - " + tagReading.getTid()); }//from w w w. ja v a2 s. c o m // try { statusLabel.setBackground(Color.green); statusLabel.setText("Tag leido"); tidTextField.setText(tagReading.getTid().toLowerCase()); epcTextField.setText(tagReading.getEpc().toLowerCase()); programmedEpcTextField.setText(""); // find tag by EPC/TID in database logger.debug("Looking up rfid by epc " + tagReading.getEpc() + " epc char " + Hex.encodeHexString(tagReading.getEpc().getBytes())); Rfid rfid = totalRfidMap.get(tagReading.getEpc().toUpperCase()); if (rfid == null) { logger.debug("Rfid string not in database tag list. Programming tag."); // if in DB, warn // if not then program with next chipnumber programTag(tagReading); } else { logger.debug("Rfid string IN database tag list."); Rfid batchRfid = rfidMap.get(tagReading.getEpc()); if (batchRfid == null) { logger.debug("Rfid string IN current program batch"); int response = JOptionPane.showConfirmDialog(this, "Este tag tiene un cdigo que existe en el evento actual.\n" + "Corresponde al nmero " + rfid.getBib() + "\nDesea sobreescribir este tag?", "Tag ya programado", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE); if (response == JOptionPane.YES_OPTION) { programTag(tagReading); } } else { JOptionPane.showMessageDialog(this, "Este tag tiene un cdigo que ya ha sido programado en este lote.", "Tag ya programado", JOptionPane.ERROR_MESSAGE); } } try { Thread.sleep(1000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } statusLabel.setBackground(Color.white); statusLabel.setText("Remover tag"); try { Thread.sleep(500); } catch (InterruptedException e1) { e1.printStackTrace(); } } catch (ReaderException e) { // TODO Auto-generated catch block e.printStackTrace(); statusLabel.setBackground(Color.red); statusLabel.setText("Error"); try { Thread.sleep(500); } catch (InterruptedException e1) { e1.printStackTrace(); } } } } } else { statusLabel.setBackground(Color.orange); statusLabel.setText("Dos o ms tags"); } } else { statusLabel.setBackground(Color.yellow); statusLabel.setText("Sin tag"); } }
From source file:DialogDemo.java
/** Creates the panel shown by the second tab. */ private JPanel createFeatureDialogBox() { final int numButtons = 5; JRadioButton[] radioButtons = new JRadioButton[numButtons]; final ButtonGroup group = new ButtonGroup(); JButton showItButton = null;//from w ww .ja v a 2 s . c om final String pickOneCommand = "pickone"; final String textEnteredCommand = "textfield"; final String nonAutoCommand = "nonautooption"; final String customOptionCommand = "customoption"; final String nonModalCommand = "nonmodal"; radioButtons[0] = new JRadioButton("Pick one of several choices"); radioButtons[0].setActionCommand(pickOneCommand); radioButtons[1] = new JRadioButton("Enter some text"); radioButtons[1].setActionCommand(textEnteredCommand); radioButtons[2] = new JRadioButton("Non-auto-closing dialog"); radioButtons[2].setActionCommand(nonAutoCommand); radioButtons[3] = new JRadioButton("Input-validating dialog " + "(with custom message area)"); radioButtons[3].setActionCommand(customOptionCommand); radioButtons[4] = new JRadioButton("Non-modal dialog"); radioButtons[4].setActionCommand(nonModalCommand); for (int i = 0; i < numButtons; i++) { group.add(radioButtons[i]); } radioButtons[0].setSelected(true); showItButton = new JButton("Show it!"); showItButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String command = group.getSelection().getActionCommand(); // pick one of many if (command == pickOneCommand) { Object[] possibilities = { "ham", "spam", "yam" }; String s = (String) JOptionPane.showInputDialog(frame, "Complete the sentence:\n" + "\"Green eggs and...\"", "Customized Dialog", JOptionPane.PLAIN_MESSAGE, icon, possibilities, "ham"); // If a string was returned, say so. if ((s != null) && (s.length() > 0)) { setLabel("Green eggs and... " + s + "!"); return; } // If you're here, the return value was null/empty. setLabel("Come on, finish the sentence!"); // text input } else if (command == textEnteredCommand) { String s = (String) JOptionPane.showInputDialog(frame, "Complete the sentence:\n" + "\"Green eggs and...\"", "Customized Dialog", JOptionPane.PLAIN_MESSAGE, icon, null, "ham"); // If a string was returned, say so. if ((s != null) && (s.length() > 0)) { setLabel("Green eggs and... " + s + "!"); return; } // If you're here, the return value was null/empty. setLabel("Come on, finish the sentence!"); // non-auto-closing dialog } else if (command == nonAutoCommand) { final JOptionPane optionPane = new JOptionPane( "The only way to close this dialog is by\n" + "pressing one of the following buttons.\n" + "Do you understand?", JOptionPane.QUESTION_MESSAGE, JOptionPane.YES_NO_OPTION); // You can't use pane.createDialog() because that // method sets up the JDialog with a property change // listener that automatically closes the window // when a button is clicked. final JDialog dialog = new JDialog(frame, "Click a button", true); dialog.setContentPane(optionPane); dialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE); dialog.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent we) { setLabel("Thwarted user attempt to close window."); } }); optionPane.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent e) { String prop = e.getPropertyName(); if (dialog.isVisible() && (e.getSource() == optionPane) && (JOptionPane.VALUE_PROPERTY.equals(prop))) { // If you were going to check something // before closing the window, you'd do // it here. dialog.setVisible(false); } } }); dialog.pack(); dialog.setLocationRelativeTo(frame); dialog.setVisible(true); int value = ((Integer) optionPane.getValue()).intValue(); if (value == JOptionPane.YES_OPTION) { setLabel("Good."); } else if (value == JOptionPane.NO_OPTION) { setLabel("Try using the window decorations " + "to close the non-auto-closing dialog. " + "You can't!"); } else { setLabel("Window unavoidably closed (ESC?)."); } // non-auto-closing dialog with custom message area // NOTE: if you don't intend to check the input, // then just use showInputDialog instead. } else if (command == customOptionCommand) { customDialog.setLocationRelativeTo(frame); customDialog.setVisible(true); String s = customDialog.getValidatedText(); if (s != null) { // The text is valid. setLabel("Congratulations! " + "You entered \"" + s + "\"."); } // non-modal dialog } else if (command == nonModalCommand) { // Create the dialog. final JDialog dialog = new JDialog(frame, "A Non-Modal Dialog"); // Add contents to it. It must have a close button, // since some L&Fs (notably Java/Metal) don't provide one // in the window decorations for dialogs. JLabel label = new JLabel("<html><p align=center>" + "This is a non-modal dialog.<br>" + "You can have one or more of these up<br>" + "and still use the main window."); label.setHorizontalAlignment(JLabel.CENTER); Font font = label.getFont(); label.setFont(label.getFont().deriveFont(font.PLAIN, 14.0f)); JButton closeButton = new JButton("Close"); closeButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { dialog.setVisible(false); dialog.dispose(); } }); JPanel closePanel = new JPanel(); closePanel.setLayout(new BoxLayout(closePanel, BoxLayout.LINE_AXIS)); closePanel.add(Box.createHorizontalGlue()); closePanel.add(closeButton); closePanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 5)); JPanel contentPane = new JPanel(new BorderLayout()); contentPane.add(label, BorderLayout.CENTER); contentPane.add(closePanel, BorderLayout.PAGE_END); contentPane.setOpaque(true); dialog.setContentPane(contentPane); // Show it. dialog.setSize(new Dimension(300, 150)); dialog.setLocationRelativeTo(frame); dialog.setVisible(true); } } }); return createPane(moreDialogDesc + ":", radioButtons, showItButton); }
From source file:com.floreantpos.ui.views.payment.SettleTicketDialog.java
public void doSettleBarTabTicket(Ticket ticket) { try {/*from w ww .j av a 2s . c om*/ String msg = "Do you want to settle ticket?"; //$NON-NLS-1$ int option1 = POSMessageDialog.showYesNoQuestionDialog(null, msg, Messages.getString("NewBarTabAction.4")); //$NON-NLS-1$ if (option1 != JOptionPane.YES_OPTION) { return; } else { for (PosTransaction barTabTransaction : ticket.getTransactions()) { barTabTransaction.setAmount(ticket.getDueAmount()); barTabTransaction.setTenderAmount(ticket.getDueAmount()); barTabTransaction.setAuthorizable(true); settleTicket(barTabTransaction); } } } catch (Exception e) { POSMessageDialog.showError(Application.getPosWindow(), e.getMessage(), e); } }
From source file:com.biosis.biosislite.vistas.inventario.MantenimientoProveedor.java
private void btnguardarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnguardarActionPerformed // TODO add your handling code here: List<Integer> array = new ArrayList(); array.add(FormularioUtil.Validar(FormularioUtil.TipoValidacion.LETRA, this.telefonoField, "telefono")); array.add(FormularioUtil.Validar(FormularioUtil.TipoValidacion.LETRA, this.rucField, "ruc")); // array.add(FormularioUtil.Validar(FormularioUtil.TipoValidacion.NUMERO, this.direccionField, "direccion")); array.add(/*from ww w . j a v a 2s. co m*/ FormularioUtil.Validar(FormularioUtil.TipoValidacion.NUMERO, this.nombreField, "nombreProveedor")); FormularioUtil.validar2(array); if (FormularioUtil.error) { JOptionPane.showMessageDialog(null, FormularioUtil.mensaje, "Mensaje del Sistema", JOptionPane.ERROR_MESSAGE); FormularioUtil.mensaje = ""; FormularioUtil.error = false; } else { String palabra = ""; String palabra2 = ""; if (accion == 1) { palabra = "registrar"; palabra2 = "registrado"; if (JOptionPane.showConfirmDialog(null, "Desea " + palabra + " el Proveedor?", "Mensaje del Sistema", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) { // proveedorControlador.getSeleccionado().setDni(idField.getText().toUpperCase()); proveedorControlador.getSeleccionado().setNombreProveedor(nombreField.getText().toUpperCase()); proveedorControlador.getSeleccionado().setDireccion(direccionField.getText().toUpperCase()); proveedorControlador.getSeleccionado().setRuc(rucField.getText().toUpperCase()); proveedorControlador.getSeleccionado().setTelefono(telefonoField.getText().toUpperCase()); proveedorControlador.accion(accion); lista.add(proveedorControlador.getSeleccionado()); if (accion == 1) { JOptionPane.showMessageDialog(null, "Proveedor " + palabra2 + " correctamente", "Mensaje del Sistema", JOptionPane.INFORMATION_MESSAGE); FormularioUtil.limpiarComponente(panelDatos); } else { JOptionPane.showMessageDialog(null, "Proveedor no " + palabra2, "Mensaje del Sistema", JOptionPane.ERROR_MESSAGE); } } else { FormularioUtil.limpiarComponente(panelDatos); JOptionPane.showMessageDialog(null, "Proveedor no " + palabra2, "Mensaje del Sistema", JOptionPane.ERROR_MESSAGE); } } else if (accion == 2) { palabra = "modificar"; palabra2 = "modificado"; if (JOptionPane.showConfirmDialog(null, "Desea " + palabra + " el Proveedor?", "Mensaje del Sistema", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) { if (accion == 2) { JOptionPane.showMessageDialog(null, "Proveedor " + palabra2 + " correctamente", "Mensaje del Sistema", JOptionPane.INFORMATION_MESSAGE); lista.clear(); proveedorControlador.getSeleccionado() .setNombreProveedor(nombreField.getText().toUpperCase()); proveedorControlador.getSeleccionado().setDireccion(direccionField.getText().toUpperCase()); proveedorControlador.getSeleccionado().setRuc(rucField.getText().toUpperCase()); proveedorControlador.getSeleccionado().setTelefono(telefonoField.getText().toUpperCase()); proveedorControlador.accion(accion); listar(); FormularioUtil.limpiarComponente(panelDatos); } else { JOptionPane.showMessageDialog(null, "Proveedor no " + palabra2, "Mensaje del Sistema", JOptionPane.ERROR_MESSAGE); } } else { FormularioUtil.limpiarComponente(panelDatos); JOptionPane.showMessageDialog(null, "Proveedor no " + palabra2, "Mensaje del Sistema", JOptionPane.ERROR_MESSAGE); } } FormularioUtil.limpiarComponente(panelDatos); FormularioUtil.activarComponente(panelOpciones, true); FormularioUtil.activarComponente(panelGuardar, false); FormularioUtil.activarComponente(panelDatos, false); } }
From source file:com.proyecto.vista.MantenimientoAmbiente.java
private void btneliminarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btneliminarActionPerformed // TODO add your handling code here: accion = Controlador.ELIMINAR;/*from w w w . ja va 2 s.c o m*/ if (tblambientes.getSelectedRow() != -1) { Integer codigo = tblambientes.getSelectedRow(); Ambiente ambiente = ambienteControlador.buscarPorId(lista.get(codigo).getCodigo()); if (ambiente != null) { if (JOptionPane.showConfirmDialog(null, "Desea Eliminar la Ambiente?", "Mensaje del Sistema", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) { int[] filas = tblambientes.getSelectedRows(); for (int i = 0; i < filas.length; i++) { Ambiente ambiente2 = lista.get(filas[0]); lista.remove(ambiente2); ambienteControlador.setSeleccionado(ambiente2); ambienteControlador.accion(accion); } if (ambienteControlador.accion(accion) == 3) { JOptionPane.showMessageDialog(null, "Ambiente eliminada correctamente", "Mensaje del Sistema", JOptionPane.INFORMATION_MESSAGE); } else { JOptionPane.showMessageDialog(null, "Ambiente no eliminada", "Mensaje del Sistema", JOptionPane.ERROR_MESSAGE); } } else { JOptionPane.showMessageDialog(null, "Ambiente no eliminado", "Mensaje del Sistema", JOptionPane.ERROR_MESSAGE); } } } else { JOptionPane.showMessageDialog(null, "Debe seleccionar un Ambiente", "Mensaje del Sistema", JOptionPane.ERROR_MESSAGE); } }
From source file:de.tor.tribes.ui.views.DSWorkbenchSelectionFrame.java
private void copyBBToExternalClipboardEvent() { try {//from ww w . j ava2s.co m List<Village> selection = getSelectedElements(); if (selection.isEmpty()) { showInfo("Keine Elemente ausgewhlt"); return; } boolean extended = (JOptionPaneHelper.showQuestionConfirmBox(this, "Erweiterte BB-Codes verwenden (nur fr Forum und Notizen geeignet)?", "Erweiterter BB-Code", "Nein", "Ja") == JOptionPane.YES_OPTION); StringBuilder buffer = new StringBuilder(); if (extended) { buffer.append("[u][size=12]Dorfliste[/size][/u]\n\n"); } else { buffer.append("[u]Dorfliste[/u]\n\n"); } buffer.append(new VillageListFormatter().formatElements(selection, extended)); if (extended) { buffer.append("\n[size=8]Erstellt am "); buffer.append( new SimpleDateFormat("dd.MM.yy 'um' HH:mm:ss").format(Calendar.getInstance().getTime())); buffer.append(" mit DS Workbench "); buffer.append(Constants.VERSION).append(Constants.VERSION_ADDITION + "[/size]\n"); } else { buffer.append("\nErstellt am "); buffer.append( new SimpleDateFormat("dd.MM.yy 'um' HH:mm:ss").format(Calendar.getInstance().getTime())); buffer.append(" mit DS Workbench "); buffer.append(Constants.VERSION).append(Constants.VERSION_ADDITION + "\n"); } String b = buffer.toString(); StringTokenizer t = new StringTokenizer(b, "["); int cnt = t.countTokens(); if (cnt > 1000) { if (JOptionPaneHelper.showQuestionConfirmBox(this, "Die ausgewhlten Drfer bentigen mehr als 1000 BB-Codes\n" + "und knnen daher im Spiel (Forum/IGM/Notizen) nicht auf einmal dargestellt werden.\nTrotzdem exportieren?", "Zu viele BB-Codes", "Nein", "Ja") == JOptionPane.NO_OPTION) { return; } } Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(b), null); showSuccess("Daten in Zwischenablage kopiert"); } catch (Exception e) { logger.error("Failed to copy data to clipboard", e); showError("Fehler beim Kopieren in die Zwischenablage"); } }
From source file:au.org.ala.delta.intkey.directives.invocation.UseDirectiveInvocation.java
private boolean checkCharacterUsable(au.org.ala.delta.model.Character ch, IntkeyContext context, boolean warnAlreadySetOrMaybeInapplicable) { CharacterFormatter formatter = new CharacterFormatter(true, CommentStrippingMode.RETAIN, AngleBracketHandlingMode.REPLACE, true, false); // is character fixed? if (context.charactersFixed()) { if (context.getFixedCharactersList().contains(ch.getCharacterId())) { if (!context.isProcessingDirectivesFile()) { String msg = UIUtils.getResourceString("UseDirective.CharacterFixed", formatter.formatCharacterDescription(ch)); String title = UIUtils.getResourceString("Intkey.informationDlgTitle"); JOptionPane.showMessageDialog(UIUtils.getMainFrame(), msg, title, JOptionPane.ERROR_MESSAGE); }//from ww w . ja v a 2 s .c o m return false; } } // is character already used? if (warnAlreadySetOrMaybeInapplicable) { if (context.getSpecimen().hasValueFor(ch)) { if (context.isProcessingDirectivesFile()) { return true; } else { String msg = UIUtils.getResourceString("UseDirective.CharacterAlreadyUsed", formatter.formatCharacterDescription(ch)); String title = UIUtils.getResourceString("Intkey.informationDlgTitle"); int choice = JOptionPane.showConfirmDialog(UIUtils.getMainFrame(), msg, title, JOptionPane.YES_NO_OPTION); if (choice == JOptionPane.YES_OPTION) { return true; } else { return false; } } } } // is character maybe inapplicable? if (warnAlreadySetOrMaybeInapplicable) { if (context.getSpecimen().isCharacterMaybeInapplicable(ch)) { if (context.isProcessingDirectivesFile()) { return true; } else { String msg = UIUtils.getResourceString("UseDirective.CharacterMaybeInapplicable", formatter.formatCharacterDescription(ch)); String title = UIUtils.getResourceString("Intkey.informationDlgTitle"); int choice = JOptionPane.showConfirmDialog(UIUtils.getMainFrame(), msg, title, JOptionPane.YES_NO_OPTION); if (choice == JOptionPane.YES_OPTION) { return true; } else { return false; } } } } // is character unavailable? if (context.getSpecimen().isCharacterInapplicable(ch)) { if (!context.isProcessingDirectivesFile()) { String msg = UIUtils.getResourceString("UseDirective.CharacterUnavailable", formatter.formatCharacterDescription(ch)); String title = UIUtils.getResourceString("Intkey.informationDlgTitle", formatter.formatCharacterDescription(ch)); JOptionPane.showMessageDialog(UIUtils.getMainFrame(), msg, title, JOptionPane.ERROR_MESSAGE); } return false; } // is character excluded? if (!context.getIncludedCharacters().contains(ch)) { if (!context.isProcessingDirectivesFile()) { String msg = UIUtils.getResourceString("UseDirective.CharacterExcluded", formatter.formatCharacterDescription(ch)); String title = UIUtils.getResourceString("Intkey.informationDlgTitle", formatter.formatCharacterDescription(ch)); JOptionPane.showMessageDialog(UIUtils.getMainFrame(), msg, title, JOptionPane.ERROR_MESSAGE); } return false; } return true; }