Example usage for javax.swing JOptionPane INFORMATION_MESSAGE

List of usage examples for javax.swing JOptionPane INFORMATION_MESSAGE

Introduction

In this page you can find the example usage for javax.swing JOptionPane INFORMATION_MESSAGE.

Prototype

int INFORMATION_MESSAGE

To view the source code for javax.swing JOptionPane INFORMATION_MESSAGE.

Click Source Link

Document

Used for information messages.

Usage

From source file:edu.ku.brc.specify.config.init.secwiz.UserPanel.java

/**
 * @param doGainAccess/*w  w  w .  j  a  va  2 s  . co  m*/
 */
private void changeMasterAccess(final boolean doGainAccess) {
    String msg = UIRegistry.getResourceString(doGainAccess ? "DO_GAIN_ACCESS" : "DO_LOOSE_ACCESS");
    if (UIRegistry.askYesNoLocalized("YES", "NO", msg, "WARNING") == JOptionPane.NO_OPTION) {
        return;
    }

    DBMSUserMgr mgr = DBMSUserMgr.getInstance();

    String dbUserName = properties.getProperty("dbUserName");
    String dbPassword = properties.getProperty("dbPassword");
    String saUserName = properties.getProperty("saUserName");
    String hostName = properties.getProperty("hostName");

    String dbName = doGainAccess ? otherDBName : databaseName;

    if (mgr.getConnection() == null) {
        if (!mgr.connectToDBMS(dbUserName, dbPassword, hostName)) {
            UIRegistry.showError("Unable to login.");
            return;
        }
    }

    ArrayList<String> changedNames = new ArrayList<String>();
    ArrayList<String> noChangeNames = new ArrayList<String>();

    JList list = doGainAccess ? otherDBList : dbList;
    int[] inxs = list.getSelectedIndices();
    for (int inx : inxs) {
        String dbNm = (String) list.getModel().getElementAt(inx);
        if (mgr.setPermissions(saUserName, dbNm,
                doGainAccess ? DBMSUserMgr.PERM_ALL_BASIC : DBMSUserMgr.PERM_NONE)) {
            changedNames.add(dbNm);
        } else {
            noChangeNames.add(dbNm);
        }
    }

    for (String nm : changedNames) {
        if (doGainAccess) {
            ((DefaultListModel) otherDBList.getModel()).removeElement(nm);
            ((DefaultListModel) dbList.getModel()).addElement(nm);
        } else {
            ((DefaultListModel) otherDBList.getModel()).addElement(nm);
            ((DefaultListModel) dbList.getModel()).removeElement(nm);
        }
    }

    if (inxs.length == 1) {
        UIRegistry.showLocalizedMsg(JOptionPane.INFORMATION_MESSAGE, "MSTR_PERM_CHGED_TITLE",
                doGainAccess ? "MSTR_PERM_ADDED" : "MSTR_PERM_DEL", saUserName, dbName);
        final int selInx = inxs[0];
        SwingUtilities.invokeLater(new Runnable() {
            @Override
            public void run() {
                dbList.setSelectedIndex(selInx);
            }
        });
    } else {
        UIRegistry.showLocalizedMsg(JOptionPane.INFORMATION_MESSAGE, "MSTR_PERM_CHGED_TITLE",
                doGainAccess ? "MSTR_NUM_PERM_ADDED" : "MSTR_NUM_PERM_DEL", saUserName, changedNames.size());
    }

    mgr.close();
}

From source file:net.jradius.client.gui.JRadiusSimulator.java

/**
 * This method initializes jMenuItem//from  w w w  . jav  a2 s .  c  o  m
 * 
 * @return javax.swing.JMenuItem
 */
private JMenuItem getAboutMenuItem() {
    if (aboutMenuItem == null) {
        aboutMenuItem = new JMenuItem();
        aboutMenuItem.setText("About");
        aboutMenuItem.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                JOptionPane.showMessageDialog(JRadiusSimulator.this,
                        "Version 1.3.0\n\n" + "For help, go to http://www.coova.org/JRadius\n"
                                + "Licensed under the GNU General Public License (GPL).\n"
                                + "Copyright (c) 2007-2011 Coova Technologies, LLC\n",
                        "Copyright (c) 2006 PicoPoint B.V.\n" + "About JRadiusSimulator",
                        JOptionPane.INFORMATION_MESSAGE, null);
            }
        });
    }
    return aboutMenuItem;
}

From source file:org.owasp.webscarab.plugin.sessionid.swing.SessionIDPanel.java

private void testButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_testButtonActionPerformed
    try {//from   w w w. j  av  a 2s.  c  o m
        final Request request = _requestPanel.getRequest();
        if (request == null) {
            return;
        }
        testButton.setEnabled(false);
        final Component parent = this;
        new SwingWorker() {
            public Object construct() {
                try {
                    _sa.setRequest(request);
                    _sa.fetchResponse();
                    return _sa.getResponse();
                } catch (IOException ioe) {
                    return ioe;
                }
            }

            //Runs on the event-dispatching thread.
            public void finished() {
                Object obj = getValue();
                if (obj instanceof Response) {
                    Response response = (Response) getValue();
                    if (response != null) {
                        _responsePanel.setResponse(response);
                        String name = nameTextField.getText();
                        String regex = regexTextField.getText();
                        try {
                            Map<String, SessionID> ids = _sa.getIDsFromResponse(response, name, regex);
                            String[] keys = ids.keySet().toArray(new String[0]);
                            for (int i = 0; i < keys.length; i++) {
                                SessionID id = ids.get(keys[i]);
                                keys[i] = keys[i] + " = " + id.getValue();
                            }
                            if (keys.length == 0)
                                keys = new String[] { "No session identifiers found!" };
                            JOptionPane.showMessageDialog(parent, keys, "Extracted Sessionids",
                                    JOptionPane.INFORMATION_MESSAGE);
                        } catch (PatternSyntaxException pse) {
                            JOptionPane.showMessageDialog(parent, pse.getMessage(), "Patter Syntax Exception",
                                    JOptionPane.WARNING_MESSAGE);
                        }
                    }
                } else if (obj instanceof Exception) {
                    JOptionPane.showMessageDialog(null,
                            new String[] { "Error fetching response: ", obj.toString() }, "Error",
                            JOptionPane.ERROR_MESSAGE);
                    _logger.severe("Exception fetching response: " + obj);
                }
                testButton.setEnabled(true);
            }
        }.start();
    } catch (MalformedURLException mue) {
        JOptionPane.showMessageDialog(this, new String[] { "The URL requested is malformed", mue.getMessage() },
                "Malformed URL", JOptionPane.ERROR_MESSAGE);
    } catch (ParseException pe) {
        JOptionPane.showMessageDialog(this, new String[] { "The request is malformed", pe.getMessage() },
                "Malformed Request", JOptionPane.ERROR_MESSAGE);
    }

}

From source file:be.ugent.maf.cellmissy.gui.controller.analysis.doseresponse.generic.GenericDoseResponseController.java

/**
 * Ask user to choose for a directory and invoke swing worker for creating
 * PDF report// www.ja  v a  2  s. c  om
 *
 * @throws IOException
 */
protected void createPdfReport() throws IOException {
    // choose directory to save pdf file
    JFileChooser chooseDirectory = new JFileChooser();
    chooseDirectory.setDialogTitle("Choose a directory to save the report");
    chooseDirectory.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
    //        needs more information
    chooseDirectory.setSelectedFile(
            new File("Dose Response Report " + importedDRDataHolder.getExperimentNumber() + ".pdf"));
    // in response to the button click, show open dialog
    //        TEST WHETHER THIS PARENT PANEL/FRAME IS OKAY
    int returnVal = chooseDirectory.showSaveDialog(cellMissyController.getCellMissyFrame());
    if (returnVal == JFileChooser.APPROVE_OPTION) {
        File directory = chooseDirectory.getCurrentDirectory();
        DoseResponseReportSwingWorker doseResponseReportSwingWorker = new DoseResponseReportSwingWorker(
                directory, chooseDirectory.getSelectedFile().getName());
        doseResponseReportSwingWorker.execute();
    } else {
        cellMissyController.showMessage("Open command cancelled by user", "", JOptionPane.INFORMATION_MESSAGE);
    }
}

From source file:com.nbt.TreeFrame.java

private void createActions() {
    newAction = new NBTAction("New", "New", "New", KeyEvent.VK_N) {

        {//from w w  w.j a  v a 2 s  . com
            putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke('N', Event.CTRL_MASK));
        }

        @Override
        public void actionPerformed(ActionEvent e) {
            updateTreeTable(new CompoundTag(""));
        }

    };

    browseAction = new NBTAction("Browse...", "Open", "Browse...", KeyEvent.VK_O) {

        {
            putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke('O', Event.CTRL_MASK));
        }

        @Override
        public void actionPerformed(ActionEvent e) {
            JFileChooser fc = createFileChooser();
            switch (fc.showOpenDialog(TreeFrame.this)) {
            case JFileChooser.APPROVE_OPTION:
                File file = fc.getSelectedFile();
                Preferences prefs = getPreferences();
                prefs.put(KEY_FILE, file.getAbsolutePath());
                doImport(file);
                break;
            }
        }

    };

    saveAction = new NBTAction("Save", "Save", "Save", KeyEvent.VK_S) {

        {
            putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke('S', Event.CTRL_MASK));
        }

        @Override
        public void actionPerformed(ActionEvent e) {
            String path = textFile.getText();
            File file = new File(path);
            if (file.canWrite()) {
                doExport(file);
            } else {
                saveAsAction.actionPerformed(e);
            }
        }

    };

    saveAsAction = new NBTAction("Save As...", "SaveAs", "Save As...", KeyEvent.VK_UNDEFINED) {

        public void actionPerformed(ActionEvent e) {
            JFileChooser fc = createFileChooser();
            switch (fc.showSaveDialog(TreeFrame.this)) {
            case JFileChooser.APPROVE_OPTION:
                File file = fc.getSelectedFile();
                Preferences prefs = getPreferences();
                prefs.put(KEY_FILE, file.getAbsolutePath());
                doExport(file);
                break;
            }
        }

    };

    refreshAction = new NBTAction("Refresh", "Refresh", "Refresh", KeyEvent.VK_F5) {

        {
            putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke("F5"));
        }

        public void actionPerformed(ActionEvent e) {
            String path = textFile.getText();
            File file = new File(path);
            if (file.canRead())
                doImport(file);
            else
                showErrorDialog("The file could not be read.");
        }

    };

    exitAction = new NBTAction("Exit", "Exit", KeyEvent.VK_ESCAPE) {

        @Override
        public void actionPerformed(ActionEvent e) {
            // TODO: this should check to see if any changes have been made
            // before exiting
            System.exit(0);
        }

    };

    cutAction = new DefaultEditorKit.CutAction() {

        {
            String name = "Cut";
            putValue(NAME, name);
            putValue(SHORT_DESCRIPTION, name);
            putValue(MNEMONIC_KEY, KeyEvent.VK_X);
            putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke('X', Event.CTRL_MASK));

            ImageFactory factory = new ImageFactory();
            try {
                putValue(SMALL_ICON, new ImageIcon(factory.readGeneralImage(name, NBTAction.smallIconSize)));
            } catch (IOException e) {
                e.printStackTrace();
            }

            try {
                putValue(LARGE_ICON_KEY,
                        new ImageIcon(factory.readGeneralImage(name, NBTAction.largeIconSize)));
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    };

    copyAction = new DefaultEditorKit.CopyAction() {

        {
            String name = "Copy";
            putValue(NAME, name);
            putValue(SHORT_DESCRIPTION, name);
            putValue(MNEMONIC_KEY, KeyEvent.VK_C);
            putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke('C', Event.CTRL_MASK));

            ImageFactory factory = new ImageFactory();
            try {
                putValue(SMALL_ICON, new ImageIcon(factory.readGeneralImage(name, NBTAction.smallIconSize)));
            } catch (IOException e) {
                e.printStackTrace();
            }

            try {
                putValue(LARGE_ICON_KEY,
                        new ImageIcon(factory.readGeneralImage(name, NBTAction.largeIconSize)));
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    };

    pasteAction = new DefaultEditorKit.CutAction() {

        {
            String name = "Paste";
            putValue(NAME, name);
            putValue(SHORT_DESCRIPTION, name);
            putValue(MNEMONIC_KEY, KeyEvent.VK_V);
            putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke('V', Event.CTRL_MASK));

            ImageFactory factory = new ImageFactory();
            try {
                putValue(SMALL_ICON, new ImageIcon(factory.readGeneralImage(name, NBTAction.smallIconSize)));
            } catch (IOException e) {
                e.printStackTrace();
            }

            try {
                putValue(LARGE_ICON_KEY,
                        new ImageIcon(factory.readGeneralImage(name, NBTAction.largeIconSize)));
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

    };

    deleteAction = new NBTAction("Delete", "Delete", "Delete", KeyEvent.VK_DELETE) {

        {
            putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke("DELETE"));
        }

        public void actionPerformed(ActionEvent e) {
            int row = treeTable.getSelectedRow();
            TreePath path = treeTable.getPathForRow(row);
            Object last = path.getLastPathComponent();

            if (last instanceof NBTFileBranch) {
                NBTFileBranch branch = (NBTFileBranch) last;
                File file = branch.getFile();
                String name = file.getName();
                String message = "Are you sure you want to delete " + name + "?";
                String title = "Continue?";
                int option = JOptionPane.showConfirmDialog(TreeFrame.this, message, title,
                        JOptionPane.OK_CANCEL_OPTION);
                switch (option) {
                case JOptionPane.CANCEL_OPTION:
                    return;
                }
                if (!FileUtils.deleteQuietly(file)) {
                    showErrorDialog(name + " could not be deleted.");
                    return;
                }
            }

            TreePath parentPath = path.getParentPath();
            Object parentLast = parentPath.getLastPathComponent();
            NBTTreeTableModel model = treeTable.getTreeTableModel();
            int index = model.getIndexOfChild(parentLast, last);
            if (parentLast instanceof Mutable<?>) {
                Mutable<?> mutable = (Mutable<?>) parentLast;
                if (last instanceof ByteWrapper) {
                    ByteWrapper wrapper = (ByteWrapper) last;
                    index = wrapper.getIndex();
                }
                mutable.remove(index);
            } else {
                System.err.println(last.getClass());
                return;
            }

            updateTreeTable();
            treeTable.expandPath(parentPath);
            scrollTo(parentLast);
            treeTable.setRowSelectionInterval(row, row);
        }

    };

    openAction = new NBTAction("Open...", "Open...", KeyEvent.VK_T) {

        {
            putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke('T', Event.CTRL_MASK));

            final int diamondPickaxe = 278;
            SpriteRecord record = NBTTreeTable.register.getRecord(diamondPickaxe);
            BufferedImage image = record.getImage();
            setSmallIcon(image);

            int width = 24, height = 24;
            Dimension size = new Dimension(width, height);
            Map<RenderingHints.Key, ?> hints = Thumbnail.createRenderingHints(Thumbnail.QUALITY);
            BufferedImage largeImage = Thumbnail.createThumbnail(image, size, hints);
            setLargeIcon(largeImage);
        }

        public void actionPerformed(ActionEvent e) {
            TreePath path = treeTable.getPath();
            if (path == null)
                return;

            Object last = path.getLastPathComponent();
            if (last instanceof Region) {
                Region region = (Region) last;
                createAndShowTileCanvas(new TileCanvas.TileWorld(region));
                return;
            } else if (last instanceof World) {
                World world = (World) last;
                createAndShowTileCanvas(world);
                return;
            }

            if (last instanceof NBTFileBranch) {
                NBTFileBranch fileBranch = (NBTFileBranch) last;
                File file = fileBranch.getFile();
                try {
                    open(file);
                } catch (IOException ex) {
                    ex.printStackTrace();
                    showErrorDialog(ex.getMessage());
                }
            }
        }

        private void open(File file) throws IOException {
            if (Desktop.isDesktopSupported()) {
                Desktop desktop = Desktop.getDesktop();
                if (desktop.isSupported(Desktop.Action.OPEN)) {
                    desktop.open(file);
                }
            }
        }

    };

    addByteAction = new NBTAction("Add Byte", NBTConstants.TYPE_BYTE, "Add Byte", KeyEvent.VK_1) {

        {
            putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke('1', Event.CTRL_MASK));
        }

        public void actionPerformed(ActionEvent e) {
            addTag(new ByteTag("new byte", (byte) 0));
        }

    };

    addShortAction = new NBTAction("Add Short", NBTConstants.TYPE_SHORT, "Add Short", KeyEvent.VK_2) {

        {
            putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke('2', Event.CTRL_MASK));
        }

        public void actionPerformed(ActionEvent e) {
            addTag(new ShortTag("new short", (short) 0));
        }

    };

    addIntAction = new NBTAction("Add Integer", NBTConstants.TYPE_INT, "Add Integer", KeyEvent.VK_3) {

        {
            putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke('3', Event.CTRL_MASK));
        }

        public void actionPerformed(ActionEvent e) {
            addTag(new IntTag("new int", 0));
        }

    };

    addLongAction = new NBTAction("Add Long", NBTConstants.TYPE_LONG, "Add Long", KeyEvent.VK_4) {

        {
            putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke('4', Event.CTRL_MASK));
        }

        public void actionPerformed(ActionEvent e) {
            addTag(new LongTag("new long", 0));
        }

    };

    addFloatAction = new NBTAction("Add Float", NBTConstants.TYPE_FLOAT, "Add Float", KeyEvent.VK_5) {

        {
            putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke('5', Event.CTRL_MASK));
        }

        public void actionPerformed(ActionEvent e) {
            addTag(new FloatTag("new float", 0));
        }

    };

    addDoubleAction = new NBTAction("Add Double", NBTConstants.TYPE_DOUBLE, "Add Double", KeyEvent.VK_6) {

        {
            putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke('6', Event.CTRL_MASK));
        }

        public void actionPerformed(ActionEvent e) {
            addTag(new DoubleTag("new double", 0));
        }

    };

    addByteArrayAction = new NBTAction("Add Byte Array", NBTConstants.TYPE_BYTE_ARRAY, "Add Byte Array",
            KeyEvent.VK_7) {

        {
            putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke('7', Event.CTRL_MASK));
        }

        public void actionPerformed(ActionEvent e) {
            addTag(new ByteArrayTag("new byte array"));
        }

    };

    addStringAction = new NBTAction("Add String", NBTConstants.TYPE_STRING, "Add String", KeyEvent.VK_8) {

        {
            putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke('8', Event.CTRL_MASK));
        }

        public void actionPerformed(ActionEvent e) {
            addTag(new StringTag("new string", "..."));
        }

    };

    addListAction = new NBTAction("Add List Tag", NBTConstants.TYPE_LIST, "Add List Tag", KeyEvent.VK_9) {

        {
            putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke('9', Event.CTRL_MASK));
        }

        public void actionPerformed(ActionEvent e) {
            Class<? extends Tag> type = queryType();
            if (type != null)
                addTag(new ListTag("new list", null, type));
        }

        private Class<? extends Tag> queryType() {
            Object[] items = { NBTConstants.TYPE_BYTE, NBTConstants.TYPE_SHORT, NBTConstants.TYPE_INT,
                    NBTConstants.TYPE_LONG, NBTConstants.TYPE_FLOAT, NBTConstants.TYPE_DOUBLE,
                    NBTConstants.TYPE_BYTE_ARRAY, NBTConstants.TYPE_STRING, NBTConstants.TYPE_LIST,
                    NBTConstants.TYPE_COMPOUND };
            JComboBox comboBox = new JComboBox(new DefaultComboBoxModel(items));
            comboBox.setRenderer(new DefaultListCellRenderer() {

                @Override
                public Component getListCellRendererComponent(JList list, Object value, int index,
                        boolean isSelected, boolean cellHasFocus) {
                    super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);

                    if (value instanceof Integer) {
                        Integer i = (Integer) value;
                        Class<? extends Tag> c = NBTUtils.getTypeClass(i);
                        String name = NBTUtils.getTypeName(c);
                        setText(name);
                    }

                    return this;
                }

            });
            Object[] message = { new JLabel("Please select a type."), comboBox };
            String title = "Title goes here";
            int result = JOptionPane.showOptionDialog(TreeFrame.this, message, title,
                    JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, null);
            switch (result) {
            case JOptionPane.OK_OPTION:
                ComboBoxModel model = comboBox.getModel();
                Object item = model.getSelectedItem();
                if (item instanceof Integer) {
                    Integer i = (Integer) item;
                    return NBTUtils.getTypeClass(i);
                }
            }
            return null;
        }

    };

    addCompoundAction = new NBTAction("Add Compound Tag", NBTConstants.TYPE_COMPOUND, "Add Compound Tag",
            KeyEvent.VK_0) {

        {
            putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke('0', Event.CTRL_MASK));
        }

        public void actionPerformed(ActionEvent e) {
            addTag(new CompoundTag());
        }

    };

    String name = "About " + TITLE;
    helpAction = new NBTAction(name, "Help", name, KeyEvent.VK_F1) {

        {
            putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke("F1"));
        }

        public void actionPerformed(ActionEvent e) {
            Object[] message = { new JLabel(TITLE + " " + VERSION),
                    new JLabel("\u00A9 Copyright Taggart Spilman 2011.  All rights reserved."),
                    new Hyperlink("<html><a href=\"#\">NamedBinaryTag.com</a></html>",
                            "http://www.namedbinarytag.com"),
                    new Hyperlink("<html><a href=\"#\">Contact</a></html>", "mailto:tagadvance@gmail.com"),
                    new JLabel(" "),
                    new Hyperlink("<html><a href=\"#\">JNBT was written by Graham Edgecombe</a></html>",
                            "http://jnbt.sf.net"),
                    new Hyperlink("<html><a href=\"#\">Available open-source under the BSD license</a></html>",
                            "http://jnbt.sourceforge.net/LICENSE.TXT"),
                    new JLabel(" "), new JLabel("This product includes software developed by"),
                    new Hyperlink("<html><a href=\"#\">The Apache Software Foundation</a>.</html>",
                            "http://www.apache.org"),
                    new JLabel(" "), new JLabel("Default texture pack:"),
                    new Hyperlink("<html><a href=\"#\">SOLID COLOUR. SOLID STYLE.</a></html>",
                            "http://www.minecraftforum.net/topic/72253-solid-colour-solid-style/"),
                    new JLabel("Bundled with the permission of Trigger_Proximity."),

            };
            String title = "About";
            JOptionPane.showMessageDialog(TreeFrame.this, message, title, JOptionPane.INFORMATION_MESSAGE);
        }

    };

}

From source file:edu.ku.brc.specify.config.init.RegisterSpecify.java

/**
 * @param isAnonymous/* www .  ja  v  a2 s  .c om*/
 */
private void showRegisteredNumbers(final boolean isAnonymous) {
    if (!hasInstitutionRegistered() || isAnonymous) {
        CellConstraints cc = new CellConstraints();
        PanelBuilder pb = new PanelBuilder(new FormLayout("f:p:g", "10px,p,10px"));

        pb.add(UIHelper.createI18NLabel("SpReg.ITMS_NOT_REGED"), cc.xy(1, 2));
        pb.setDefaultDialogBorder();

        CustomDialog dlg = new CustomDialog((Frame) UIRegistry.getMostRecentWindow(),
                getResourceString("SpReg.REG_TITLE"), true, CustomDialog.OKCANCELHELP, pb.getPanel());
        dlg.setCancelLabel(getResourceString("CLOSE"));
        dlg.setOkLabel(getResourceString("SpReg.REGISTER"));

        dlg.setVisible(true);

        if (dlg.getBtnPressed() == CustomDialog.OK_BTN) {
            setIsAnonymous(false);
            doStartRegister(RegisterType.Institution, false, false); // will register everything 
        }
    } else {
        UIRegistry.showLocalizedMsg(JOptionPane.INFORMATION_MESSAGE, "SpReg.REGISTER", "SpReg.ITMS_REGED");
    }
}

From source file:com.proyecto.vista.MantenimientoClase.java

private void btneliminarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btneliminarActionPerformed
    // TODO add your handling code here:
    accion = Controlador.ELIMINAR;/*w  w  w.  j a va 2  s  . c  o  m*/
    if (tblclase.getSelectedRow() != -1) {

        Integer id = tblclase.getSelectedRow();

        //            Clase clase = claseControlador.buscarPorId(lista.get(id).getId());

        if (tblclase.getSelectedRow() != -1) {
            if (JOptionPane.showConfirmDialog(null, "Desea Eliminar la Clase?", "Mensaje del Sistema",
                    JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {

                //                    int[] filas = tblclase.getSelectedRows();
                //                    for (int i = 0; i < filas.length; i++) {
                //                        Clase clase2 = lista.get(filas[0]);
                claseControlador.setSeleccionado(lista.get(id));
                lista.remove(lista.get(id));
                claseControlador.accion(accion);
                //                    }
                if (claseControlador.accion(accion) == 3) {
                    JOptionPane.showMessageDialog(null, "Clase eliminada correctamente", "Mensaje del Sistema",
                            JOptionPane.INFORMATION_MESSAGE);

                } else {
                    JOptionPane.showMessageDialog(null, "Clase no eliminada", "Mensaje del Sistema",
                            JOptionPane.ERROR_MESSAGE);
                }
            } else {
                JOptionPane.showMessageDialog(null, "Clase no eliminada", "Mensaje del Sistema",
                        JOptionPane.ERROR_MESSAGE);
            }
        }
    } else {
        JOptionPane.showMessageDialog(null, "Debe seleccionar una clase", "Mensaje del Sistema",
                JOptionPane.ERROR_MESSAGE);
    }
}

From source file:domain.Excel.java

public void reporteSesiones(Table TTabla1, Table TTabla2, Integer ITipo, Date DFechaIni, Date DFechaFin,
            Animal AAnimal) {/*from ww w  .ja  va  2 s .co  m*/

        t_tabla = TTabla1;
        t_tabla2 = TTabla2;

        animal = AAnimal;
        tipo = ITipo;
        this.fecha_ini = DFechaIni;
        this.fecha_fin = DFechaFin;

        if (t_tabla.getRowCount() <= 0 && t_tabla2.getRowCount() <= 0) {

            JOptionPane.showMessageDialog(null, "No hay datos, para exportar", gs_mensaje,
                    JOptionPane.INFORMATION_MESSAGE);
            return;
        }

        if (!showOpenFileDialog()) {
            return;
        }

        wb = new HSSFWorkbook();
        sheet = wb.createSheet("REPORTE DE SESIONES");

        styles();

        reporteSesiones();

        crearExcel();
    }

From source file:edu.ku.brc.specify.config.init.RegisterSpecify.java

/**
 * Registers the ISA number.//from   www  . j  a  va2  s  .c  o m
 */
public static void registerISA() {
    SpecifyUser spUser = AppContextMgr.getInstance().getClassObject(SpecifyUser.class);
    if (!spUser.getUserType().equals(SpecifyUserTypes.UserType.Manager.toString())) {
        UIRegistry.showLocalizedMsg("", "SpReg.MUSTBECM");
        return;
    }

    Collection collection = AppContextMgr.getInstance().getClassObject(Collection.class);
    String isaNumber = collection.getIsaNumber();
    String isaTitle = getResourceString("SpReg.ISA_TITLE");

    if (StringUtils.isNotEmpty(isaNumber)) {
        String msg = UIRegistry.getLocalizedMessage("SpReg.ISA_NUM", isaNumber);
        JOptionPane.showMessageDialog(UIRegistry.getTopWindow(), msg, isaTitle,
                JOptionPane.INFORMATION_MESSAGE);

    } else {
        final JTextField textField = UIHelper.createTextField(30);
        isaNumber = textField.getText();

        CellConstraints cc = new CellConstraints();
        PanelBuilder pb = new PanelBuilder(new FormLayout("p,2px,f:p:g", "p,10px,p"));
        pb.add(UIHelper.createI18NFormLabel("SpReg.ISA_ENT"), cc.xy(1, 1));
        pb.add(textField, cc.xy(3, 1));
        pb.add(UIHelper.createI18NLabel("SpReg.ISA_EXPL"), cc.xyw(1, 3, 3));
        pb.setDefaultDialogBorder();

        CustomDialog dlg = new CustomDialog((Frame) UIRegistry.getTopWindow(), isaTitle, true, pb.getPanel());
        dlg.createUI();
        final JButton okBtn = dlg.getOkBtn();
        okBtn.setEnabled(false);

        textField.getDocument().addDocumentListener(new DocumentAdaptor() {
            @Override
            protected void changed(DocumentEvent e) {
                if (StringUtils.isNotEmpty(textField.getText()) != okBtn.isEnabled()) {
                    okBtn.setEnabled(!okBtn.isEnabled());
                }
            }
        });

        dlg.setVisible(true);
        isaNumber = textField.getText();
        if (!dlg.isCancelled() && StringUtils.isNotEmpty(isaNumber)) {
            setIsAnonymous(false);

            collection.setIsaNumber(isaNumber);

            getInstance().doStartRegister(RegisterType.Collection, false, true);

            AppPreferences.getLocalPrefs().putBoolean(EXTRA_CHECK, true);
        }
    }
}

From source file:com.evanbelcher.DrillBook.display.DBMenuBar.java

/**
 * Check to make sure there are no points in the first page that aren't in the second page
 */// w  ww  . j  a  v  a 2s .c o  m
private boolean checkNoMissing() {
    int currentPageNum = Main.getState().getCurrentPage();
    if (currentPageNum == 1) {
        JOptionPane.showMessageDialog(this,
                "To data from the first page to the second page, navigate to the second page and click \"Play\".",
                "Can't data the first page", JOptionPane.ERROR_MESSAGE);
        return false;
    }
    PointConcurrentHashMap<Point, String> currentDots = Main.getCurrentPage().getDots();
    PointConcurrentHashMap<Point, String> previousDots = Main.getPages().get(currentPageNum - 1).getDots();
    ArrayList<String> badNames = new ArrayList<>();
    for (String name : previousDots.values()) {
        if (!currentDots.containsValue(name))
            badNames.add(name);
    }
    if (!badNames.isEmpty()) {
        String str = "The following players from last page have disappeared on this page:\n";
        for (String s : badNames)
            str += s + "\n";
        JOptionPane.showMessageDialog(this, str.trim(), "Missing Players!", JOptionPane.INFORMATION_MESSAGE);
    }
    return true;
}