Example usage for javax.swing JOptionPane QUESTION_MESSAGE

List of usage examples for javax.swing JOptionPane QUESTION_MESSAGE

Introduction

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

Prototype

int QUESTION_MESSAGE

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

Click Source Link

Document

Used for questions.

Usage

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,//from   www . 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:gdt.jgui.entity.query.JQueryPanel.java

private void removeColumn() {
    String itemName$ = (String) itemNameComboBox.getSelectedItem();
    if ("label".equals(itemName$))
        return;/*from   w  w  w  .  ja  v a  2  s.  c  o m*/
    int response = JOptionPane.showConfirmDialog(this, "Remove column '" + itemName$ + "' ?", "Confirm",
            JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
    if (response == JOptionPane.YES_OPTION) {
        try {
            Entigrator entigrator = console.getEntigrator(entihome$);
            Sack query = entigrator.getEntityAtKey(entityKey$);

            Core[] ca = query.elementGet("header.item");
            for (Core c : ca) {
                if (itemName$.equals(c.value)) {
                    query.removeElementItem("header.element", c.name);
                    query.removeElementItem("header.item", c.name);
                }
            }
            entigrator.save(query);
            DefaultTableModel model = new DefaultTableModel();
            table.setModel(model);
            showHeader();
            showContent();
        } catch (Exception e) {
            LOGGER.severe(e.toString());
        }
    }
}

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;//w  w w.  jav a 2s  .c o m
    }

    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:gdt.jgui.entity.index.JIndexPanel.java

private void initPopup() {
    try {/*from  w  ww  .  ja va2 s  .c o  m*/
        //System.out.println("IndexPanel:initPopup:selection="+selection$);
        Properties locator = Locator.toProperties(selection$);
        String nodeType$ = locator.getProperty(NODE_TYPE);
        //System.out.println("IndexPanel:initPopup:node type="+nodeType$);
        if (NODE_TYPE_ROOT.equals(nodeType$)) {
            popup = null;
            return;
        }
        if (NODE_TYPE_GROUP.equals(nodeType$)) {
            popup = new JPopupMenu();
            JMenuItem newGroupItem = new JMenuItem("New group");
            newGroupItem.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    try {
                        // System.out.println("JIndexPanel:popup:new parent group:  selection="+selection$); 
                        Properties locator = Locator.toProperties(selection$);
                        String entihome$ = locator.getProperty(Entigrator.ENTIHOME);
                        String title$ = "New group" + Identity.key().substring(0, 4);
                        JTextEditor te = new JTextEditor();
                        String teLocator$ = te.getLocator();
                        teLocator$ = Locator.append(teLocator$, Entigrator.ENTIHOME, entihome$);
                        teLocator$ = Locator.append(teLocator$, JTextEditor.TEXT, title$);
                        teLocator$ = Locator.append(teLocator$, JTextEditor.TEXT_TITLE, "Create group");
                        String ipLocator$ = getLocator();
                        ipLocator$ = Locator.append(ipLocator$, JRequester.REQUESTER_ACTION,
                                ACTION_CREATE_GROUP);
                        ipLocator$ = Locator.append(ipLocator$, SELECTION, Locator.compressText(selection$));
                        ipLocator$ = Locator.append(ipLocator$, BaseHandler.HANDLER_METHOD, "response");
                        teLocator$ = Locator.append(teLocator$, JRequester.REQUESTER_RESPONSE_LOCATOR,
                                Locator.compressText(ipLocator$));
                        JConsoleHandler.execute(console, teLocator$);
                    } catch (Exception ee) {
                        Logger.getLogger(JIndexPanel.class.getName()).info(ee.toString());
                    }
                }
            });
            popup.add(newGroupItem);
            popup.addSeparator();
            JMenuItem renameItem = new JMenuItem("Rename");
            renameItem.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    try {

                        Properties locator = Locator.toProperties(selection$);
                        String entihome$ = locator.getProperty(Entigrator.ENTIHOME);
                        String title$ = locator.getProperty(Locator.LOCATOR_TITLE);
                        JTextEditor te = new JTextEditor();
                        String teLocator$ = te.getLocator();
                        teLocator$ = Locator.append(teLocator$, Entigrator.ENTIHOME, entihome$);
                        teLocator$ = Locator.append(teLocator$, JTextEditor.TEXT, title$);
                        String ipLocator$ = getLocator();
                        ipLocator$ = Locator.append(ipLocator$, JRequester.REQUESTER_ACTION,
                                ACTION_RENAME_GROUP);
                        ipLocator$ = Locator.append(ipLocator$, SELECTION, Locator.compressText(selection$));
                        ipLocator$ = Locator.append(ipLocator$, BaseHandler.HANDLER_METHOD, "response");
                        teLocator$ = Locator.append(teLocator$, JRequester.REQUESTER_RESPONSE_LOCATOR,
                                Locator.compressText(ipLocator$));
                        JConsoleHandler.execute(console, teLocator$);
                    } catch (Exception ee) {
                        Logger.getLogger(JIndexPanel.class.getName()).info(ee.toString());
                    }
                }
            });
            popup.add(renameItem);
            JMenuItem setIconItem = new JMenuItem("Set icon");
            setIconItem.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    try {
                        Properties locator = Locator.toProperties(selection$);
                        JIconSelector is = new JIconSelector();
                        String isLocator$ = is.getLocator();
                        isLocator$ = Locator.append(isLocator$, Entigrator.ENTIHOME, entihome$);
                        String ipLocator$ = getLocator();
                        ipLocator$ = Locator.append(ipLocator$, JRequester.REQUESTER_ACTION,
                                ACTION_SET_ICON_GROUP);
                        ipLocator$ = Locator.append(ipLocator$, SELECTION, Locator.compressText(selection$));
                        ipLocator$ = Locator.append(ipLocator$, BaseHandler.HANDLER_METHOD, "response");
                        isLocator$ = Locator.append(isLocator$, JRequester.REQUESTER_RESPONSE_LOCATOR,
                                Locator.compressText(ipLocator$));
                        JConsoleHandler.execute(console, isLocator$);
                    } catch (Exception ee) {
                        Logger.getLogger(JIndexPanel.class.getName()).info(ee.toString());
                    }
                }
            });
            popup.add(setIconItem);
            JMenuItem orderItem = new JMenuItem("Order");
            orderItem.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    try {

                        Properties locator = Locator.toProperties(selection$);
                        Entigrator entigrator = console.getEntigrator(entihome$);
                        Sack index = entigrator.getEntityAtKey(entityKey$);
                        String nodeKey$ = locator.getProperty(NODE_KEY);
                        index = orderGroupDefault(index, nodeKey$);
                        index.putElementItem("index.selection", new Core(null, "selection", nodeKey$));
                        entigrator.save(index);
                        JConsoleHandler.execute(console, getLocator());
                    } catch (Exception ee) {
                        Logger.getLogger(JIndexPanel.class.getName()).info(ee.toString());
                    }

                }
            });
            popup.add(orderItem);
            popup.addSeparator();
            JMenuItem copyItem = new JMenuItem("Copy");
            copyItem.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    try {
                        cut = false;
                        console.clipboard.clear();
                        if (selection$ != null)
                            console.clipboard.putString(selection$);
                    } catch (Exception ee) {
                        Logger.getLogger(JIndexPanel.class.getName()).info(ee.toString());
                    }
                }

            });
            popup.add(copyItem);
            JMenuItem cutItem = new JMenuItem("Cut");
            cutItem.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    try {
                        cut = true;
                        console.clipboard.clear();
                        if (selection$ != null)
                            console.clipboard.putString(selection$);
                    } catch (Exception ee) {
                        Logger.getLogger(JIndexPanel.class.getName()).info(ee.toString());
                    }
                }

            });
            popup.add(cutItem);

            final String[] sa = console.clipboard.getContent();
            if (sa != null && sa.length > 0) {
                JMenuItem pasteItem = new JMenuItem("Paste");
                pasteItem.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        try {
                            //  System.out.println("JIndexPanel:popup:new parent group:  selection="+selection$); 
                            Properties selectionLocator = Locator.toProperties(selection$);
                            String indexLocator$ = getLocator();
                            String groupKey$ = selectionLocator.getProperty(NODE_KEY);
                            Properties indexLocator = Locator.toProperties(indexLocator$);
                            String entihome$ = indexLocator.getProperty(Entigrator.ENTIHOME);
                            String entityKey$ = indexLocator.getProperty(EntityHandler.ENTITY_KEY);
                            Entigrator entigrator = console.getEntigrator(entihome$);
                            Sack index = entigrator.getEntityAtKey(entityKey$);
                            for (String aSa : sa) {

                                index = pasteItemToGroup(index, groupKey$, aSa);
                            }
                            entigrator.save(index);
                            cut = false;
                            JConsoleHandler.execute(console, getLocator());
                        } catch (Exception ee) {
                            Logger.getLogger(JIndexPanel.class.getName()).info(ee.toString());
                        }
                    }
                });
                popup.add(pasteItem);

            }
            popup.addSeparator();
            JMenuItem deleteItem = new JMenuItem("Delete");
            deleteItem.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    int response = JOptionPane.showConfirmDialog(console.getContentPanel(), "Delete ?",
                            "Confirm", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
                    if (response == JOptionPane.YES_OPTION) {
                        try {

                            Properties locator = Locator.toProperties(selection$);
                            Entigrator entigrator = console.getEntigrator(entihome$);
                            Sack index = entigrator.getEntityAtKey(entityKey$);
                            String nodeKey$ = locator.getProperty(NODE_KEY);
                            String groupKey$ = locator.getProperty(NODE_GROUP_KEY);

                            index = removeNode(index, nodeKey$);
                            index.putElementItem("index.selection", new Core(null, "selection", groupKey$));
                            entigrator.save(index);
                            JConsoleHandler.execute(console, getLocator());
                        } catch (Exception ee) {
                            Logger.getLogger(JIndexPanel.class.getName()).info(ee.toString());
                        }
                    }
                }
            });
            popup.add(deleteItem);

            return;
        }
        if (NODE_TYPE_REFERENCE.equals(nodeType$)) {
            popup = new JPopupMenu();
            final String locatorType$ = locator.getProperty(Locator.LOCATOR_TYPE);

            JMenuItem openItem = new JMenuItem("Open");
            openItem.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    Properties locator = Locator.toProperties(selection$);
                    //   String locatorType$=locator.getProperty(Locator.LOCATOR_TYPE);
                    //   System.out.println("IndexPanel:open:node type="+locatorType$);
                    if (JFolderPanel.LOCATOR_TYPE_FILE.equals(locatorType$)) {
                        String filePath$ = locator.getProperty(JFolderPanel.FILE_PATH);
                        File itemFile = new File(filePath$);
                        try {
                            Desktop.getDesktop().open(itemFile);
                        } catch (Exception ee) {
                            LOGGER.info(ee.toString());
                        }
                        return;
                    }
                    if (JWeblinksPanel.LOCATOR_TYPE_WEB_LINK.equals(locatorType$)) {
                        try {
                            String url$ = locator.getProperty(JWeblinksPanel.WEB_LINK_URL);
                            Desktop.getDesktop().browse(new URI(url$));
                        } catch (Exception ee) {
                            LOGGER.info(ee.toString());
                        }
                        return;
                    }
                    String responseLocator$ = getLocator();
                    //   System.out.println("IndexPanel:open:response locator="+Locator.remove(responseLocator$,Locator.LOCATOR_ICON));

                    selection$ = Locator.append(selection$, JRequester.REQUESTER_RESPONSE_LOCATOR,
                            Locator.compressText(responseLocator$));
                    //   System.out.println("IndexPanel:open:selection="+Locator.remove(Locator.remove(selection$, Locator.LOCATOR_ICON),JRequester.REQUESTER_RESPONSE_LOCATOR));
                    selection$ = Locator.append(selection$, Entigrator.ENTIHOME, entihome$);
                    JConsoleHandler.execute(console, selection$);

                }
            });
            popup.add(openItem);
            if (JFolderPanel.LOCATOR_TYPE_FILE.equals(locator.getProperty(Locator.LOCATOR_TYPE))) {
                JMenuItem openFolderItem = new JMenuItem("Open folder");
                openFolderItem.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        Properties locator = Locator.toProperties(selection$);
                        String filePath$ = locator.getProperty(JFolderPanel.FILE_PATH);
                        File itemFile = new File(filePath$);
                        try {
                            Desktop.getDesktop().open(itemFile.getParentFile());
                        } catch (Exception ee) {
                            LOGGER.info(ee.toString());
                        }
                        return;
                    }
                });
                popup.add(openFolderItem);
            }
            JMenuItem deleteItem = new JMenuItem("Delete");
            deleteItem.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    int response = JOptionPane.showConfirmDialog(console.getContentPanel(), "Delete ?",
                            "Confirm", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
                    if (response == JOptionPane.YES_OPTION) {
                        Properties selectionLocator = Locator.toProperties(selection$);
                        String indexLocator$ = getLocator();
                        Properties indexLocator = Locator.toProperties(indexLocator$);
                        String entihome$ = indexLocator.getProperty(Entigrator.ENTIHOME);
                        String entityKey$ = indexLocator.getProperty(EntityHandler.ENTITY_KEY);
                        Entigrator entigrator = console.getEntigrator(entihome$);
                        Sack index = entigrator.getEntityAtKey(entityKey$);
                        String nodeKey$ = selectionLocator.getProperty(NODE_KEY);
                        String groupKey$ = selectionLocator.getProperty(NODE_GROUP_KEY);

                        index.removeElementItem("index.jlocator", nodeKey$);
                        index.putElementItem("index.selection", new Core(null, "selection", groupKey$));
                        entigrator.save(index);
                        JConsoleHandler.execute(console, getLocator());
                    }

                }
            });
            popup.add(deleteItem);
            popup.addSeparator();
            JMenuItem renameItem = new JMenuItem("Rename");
            renameItem.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    JConsoleHandler.execute(console, selection$);
                    try {

                        Properties locator = Locator.toProperties(selection$);
                        String entihome$ = locator.getProperty(Entigrator.ENTIHOME);
                        String nodeKey$ = locator.getProperty(NODE_KEY);
                        String title$;
                        Core title = index.getElementItem("index.title", nodeKey$);
                        if (title != null && title.value != null)
                            title$ = title.value;
                        else
                            title$ = locator.getProperty(Locator.LOCATOR_TITLE);
                        JTextEditor te = new JTextEditor();
                        String teLocator$ = te.getLocator();
                        teLocator$ = Locator.append(teLocator$, Entigrator.ENTIHOME, entihome$);
                        teLocator$ = Locator.append(teLocator$, JTextEditor.TEXT, title$);
                        String ipLocator$ = getLocator();
                        ipLocator$ = Locator.append(ipLocator$, JRequester.REQUESTER_ACTION,
                                ACTION_RENAME_REFERENCE);
                        ipLocator$ = Locator.append(ipLocator$, SELECTION, Locator.compressText(selection$));
                        ipLocator$ = Locator.append(ipLocator$, BaseHandler.HANDLER_METHOD, "response");
                        teLocator$ = Locator.append(teLocator$, JRequester.REQUESTER_RESPONSE_LOCATOR,
                                Locator.compressText(ipLocator$));
                        JConsoleHandler.execute(console, teLocator$);
                    } catch (Exception ee) {
                        Logger.getLogger(JIndexPanel.class.getName()).info(ee.toString());
                    }
                }
            });
            popup.add(renameItem);
            JMenuItem setIconItem = new JMenuItem("Set icon");
            setIconItem.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    JConsoleHandler.execute(console, selection$);
                    try {

                        Properties locator = Locator.toProperties(selection$);
                        JIconSelector is = new JIconSelector();
                        String isLocator$ = is.getLocator();
                        isLocator$ = Locator.append(isLocator$, Entigrator.ENTIHOME, entihome$);
                        String ipLocator$ = getLocator();
                        ipLocator$ = Locator.append(ipLocator$, JRequester.REQUESTER_ACTION,
                                ACTION_SET_ICON_REFERENCE);
                        ipLocator$ = Locator.append(ipLocator$, SELECTION, Locator.compressText(selection$));
                        ipLocator$ = Locator.append(ipLocator$, BaseHandler.HANDLER_METHOD, "response");
                        isLocator$ = Locator.append(isLocator$, JRequester.REQUESTER_RESPONSE_LOCATOR,
                                Locator.compressText(ipLocator$));
                        JConsoleHandler.execute(console, isLocator$);
                    } catch (Exception ee) {
                        Logger.getLogger(JIndexPanel.class.getName()).info(ee.toString());
                    }
                }
            });
            popup.add(setIconItem);
            JMenuItem resetItem = new JMenuItem("Reset");
            resetItem.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    JConsoleHandler.execute(console, selection$);
                    try {

                        Properties locator = Locator.toProperties(selection$);
                        String nodeKey$ = locator.getProperty(NODE_KEY);
                        Core title = index.getElementItem("index.title", nodeKey$);
                        if (title != null) {
                            index.removeElementItem("index.title", nodeKey$);
                            Entigrator entigrator = console.getEntigrator(entihome$);
                            entigrator.save(index);
                            JConsoleHandler.execute(console, getLocator());
                        }
                    } catch (Exception ee) {
                        Logger.getLogger(JIndexPanel.class.getName()).info(ee.toString());
                    }
                }
            });
            popup.add(resetItem);
            popup.addSeparator();
            JMenuItem copyItem = new JMenuItem("Copy");
            copyItem.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    cut = false;
                    console.clipboard.clear();
                    console.clipboard.putString(selection$);

                }
            });
            popup.add(copyItem);
            JMenuItem cutItem = new JMenuItem("Cut");
            cutItem.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    cut = true;
                    console.clipboard.clear();
                    console.clipboard.putString(selection$);
                }
            });
            popup.add(cutItem);

        }
    } catch (Exception e) {
        Logger.getLogger(getClass().getName()).severe(e.toString());
    }
}

From source file:edu.ku.brc.specify.tools.StrLocalizerApp.java

/**
 * @return true if no unsaved changes are present
 * else return results of prompt to save
 *//*from www  . j  av a  2s .  c  o m*/
protected boolean checkForChanges() {
    int s = termList.getSelectedIndex();
    if (s != -1) {
        StrLocaleEntry entry = srcFile.getKey(s);
        entry.setDstStr(textField.getText());
    }
    if (srcFile.isEdited()) {
        int response = JOptionPane.showOptionDialog((Frame) getTopWindow(),
                String.format(getResourceString("StrLocalizerApp.SaveChangesMsg"), destFile.getPath()),
                getResourceString("StrLocalizerApp.SaveChangesTitle"), JOptionPane.YES_NO_CANCEL_OPTION,
                JOptionPane.QUESTION_MESSAGE, null, null, JOptionPane.YES_OPTION);
        if (response == JOptionPane.CANCEL_OPTION) {
            return false;
        }
        if (response == JOptionPane.YES_OPTION) {
            doSave();
            return true; //what if it fails? 
        }
    }
    return true;
}

From source file:edu.ku.brc.specify.tasks.InteractionsTask.java

/**
 * @param cmdAction//  w w w. j  av a2 s.  c  om
 */
protected void checkToPrintLoan(final CommandAction cmdAction) {
    boolean isGift = cmdAction.getData() instanceof Gift;
    if (cmdAction.getData() instanceof Loan || isGift) {
        Loan loan = isGift ? null : (Loan) cmdAction.getData();
        Gift gift = isGift ? (Gift) cmdAction.getData() : null;

        Boolean doPrintInvoice = null;
        FormViewObj formViewObj = getCurrentFormViewObj();
        if (formViewObj != null) {
            Component comp = formViewObj.getControlByName("generateInvoice");
            if (comp instanceof JCheckBox) {
                doPrintInvoice = ((JCheckBox) comp).isSelected();
            }
        }

        if (doPrintInvoice == null) {
            String number = isGift ? gift.getGiftNumber() : loan.getLoanNumber();
            String btnLbl = getResourceString(isGift ? "GIFT" : "LOAN");
            String msg = getLocalizedMessage("CreateInvoiceForNum", getResourceString(isGift ? "GIFT" : "LOAN"),
                    number);
            Object[] options = { btnLbl, getResourceString("CANCEL") };
            int n = JOptionPane.showOptionDialog(UIRegistry.get(UIRegistry.FRAME), msg, btnLbl,
                    JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, //don't use a custom Icon
                    options, //the titles of buttons
                    options[0]); //default button title
            doPrintInvoice = n == 0;
        }

        // XXX DEBUG
        //printLoan = false;
        if (doPrintInvoice) {
            InfoForTaskReport invoice = getReport(isGift);

            if (invoice == null) {
                return;
            }

            DataProviderSessionIFace session = null;
            try {
                session = DataProviderFactory.getInstance().createSession();
                //session.attach(loan);

                String hql = isGift ? "FROM Gift WHERE giftId = " + gift.getGiftId()
                        : "FROM Loan WHERE loanId = " + loan.getLoanId();

                loan = isGift ? null : (Loan) session.getData(hql);
                gift = isGift ? (Gift) session.getData(hql) : null;

                Set<Shipment> shipments = isGift ? gift.getShipments() : loan.getShipments();
                boolean keepGoing = true;
                if (invoice.getSpReport() == null) {
                    if (shipments != null && shipments.size() == 0) {
                        UIRegistry.displayErrorDlg(String.format(getResourceString("NO_SHIPMENTS_ERROR"),
                                invoice.getSpAppResource().getName()));
                        keepGoing = false;
                    } else if (shipments != null && shipments.size() > 1) {
                        // XXX Do we allow them to pick a shipment or print all?
                        UIRegistry.displayErrorDlg(
                                String.format(getResourceString("MULTI_SHIPMENTS_NOT_SUPPORTED"),
                                        invoice.getSpAppResource().getName()));
                        keepGoing = false;
                    } //else
                      //{
                      // XXX At the moment this is just checking to see if there is at least one "good/valid" shipment
                      // but the hard part will be sending the correct info so the report can be printed
                      // using both a Loan Id and a Shipment ID, and at some point distinguishing between using
                      // the shipped by versus the shipper.
                      //                        Shipment shipment = isGift ? gift.getShipments().iterator().next() : loan.getShipments().iterator().next();
                      //                        if (shipment.getShippedBy() == null)
                      //                        {
                      //                            UIRegistry.displayErrorDlg(getResourceString("SHIPMENT_MISSING_SHIPPEDBY"));
                      //                            
                      //                        } else if (shipment.getShippedBy().getAddresses().size() == 0)
                      //                        {
                      //                            UIRegistry.displayErrorDlg(getResourceString("SHIPPEDBY_MISSING_ADDR"));
                      //                        } else if (shipment.getShippedTo() == null)
                      //                        {
                      //                            UIRegistry.displayErrorDlg(getResourceString("SHIPMENT_MISSING_SHIPPEDTO"));
                      //                        } else if (shipment.getShippedTo().getAddresses().size() == 0)
                      //                        {
                      //                            UIRegistry.displayErrorDlg(getResourceString("SHIPPEDTO_MISSING_ADDR"));
                      //                        } else
                      //                        {
                }
                if (keepGoing) {
                    String identTitle;
                    int tableId;
                    Integer id;
                    if (isGift) {
                        identTitle = gift.getIdentityTitle();
                        tableId = gift.getTableId();
                        id = gift.getId();
                    } else {
                        identTitle = loan.getIdentityTitle();
                        tableId = loan.getTableId();
                        id = loan.getId();
                    }

                    RecordSet rs = new RecordSet();
                    rs.initialize();
                    rs.setName(identTitle);
                    rs.setDbTableId(tableId);
                    rs.addItem(id);

                    dispatchReport(invoice, rs, "LoanInvoice");
                }

            } finally {
                if (session != null) {
                    session.close();
                }
            }
        }
    }
}

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  a va2  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);
        }
    }
}

From source file:de.huxhorn.lilith.swing.MainFrame.java

public void exportFile(EventWrapperViewPanel view) {
    long size = view.getEventSource().getBuffer().getSize();
    if (size == 0) {
        return;// ww w . j  a v  a 2 s.c  om
    }
    int returnVal = exportFileChooser.showSaveDialog(this);

    if (returnVal == JFileChooser.APPROVE_OPTION) {
        if (size > EXPORT_WARNING_SIZE) {
            String dialogTitle = "Large export! Are you sure?";
            String message = "You are about to export " + size
                    + " events. This could take some time.\nAre you sure you want to export?";
            int result = JOptionPane.showConfirmDialog(this, message, dialogTitle, JOptionPane.OK_CANCEL_OPTION,
                    JOptionPane.QUESTION_MESSAGE);
            if (JOptionPane.OK_OPTION != result) {
                return;
            }
        }
        File file = exportFileChooser.getSelectedFile();
        String fileName = file.getAbsolutePath();
        String baseName;
        if (fileName.toLowerCase().endsWith(FileConstants.FILE_EXTENSION)) {
            baseName = fileName.substring(0, fileName.length() - FileConstants.FILE_EXTENSION.length());
        } else {
            baseName = fileName;
        }

        File dataFile = new File(baseName + FileConstants.FILE_EXTENSION);
        File indexFile = new File(baseName + FileConstants.INDEX_FILE_EXTENSION);

        if (dataFile.isFile()) {
            String dialogTitle = "Overwrite file?";
            String message = "Data file does already exist!\nOverwrite data file?";
            int result = JOptionPane.showConfirmDialog(this, message, dialogTitle, JOptionPane.OK_CANCEL_OPTION,
                    JOptionPane.QUESTION_MESSAGE);
            if (JOptionPane.OK_OPTION != result) {
                return;
            }
            if (!dataFile.delete()) {
                if (logger.isWarnEnabled())
                    logger.warn("Couldn't delete existing file {}!", dataFile.getAbsolutePath());
            }
            if (indexFile.isFile() && !indexFile.delete()) {
                if (logger.isWarnEnabled())
                    logger.warn("Couldn't delete existing file {}!", indexFile.getAbsolutePath());
            }
        }

        if (view instanceof AccessEventViewPanel) {
            exportFile(dataFile, indexFile, (AccessEventViewPanel) view);
        } else if (view instanceof LoggingEventViewPanel) {
            exportFile(dataFile, indexFile, (LoggingEventViewPanel) view);
        }
    }
}

From source file:convcao.com.agent.ConvcaoNeptusInteraction.java

@Override
public void initSubPanel() {
    jPanelMain = new JPanel();
    jPanel1 = new JPanel();
    jPanel2 = new JPanel();
    jLabel2 = new JLabel();
    jScrollPane1 = new JScrollPane();
    jTextPane1 = new JTextPane();
    renewButton = new JButton();
    jLabel4 = new JLabel();
    jTextField1 = new JTextField();
    jLabel5 = new JLabel();
    jPasswordField1 = new JPasswordField();
    connectButton = new JButton();
    jScrollPane2 = new JScrollPane();
    jTextArea1 = new JTextArea();
    jLabel7 = new JLabel();
    jLabel8 = new JLabel();
    jButton1 = new JButton();
    jButton2 = new JButton();
    jLabel1 = new JLabel();
    jLabel9 = new JLabel();
    jLabel10 = new JLabel();
    jLabel11 = new JLabel();
    jLabel12 = new JLabel();
    jLabel6 = new JLabel();
    jLabel3 = new JLabel();

    jLabel11.setIcon(noptilusLogo);// w w  w. ja v a  2  s.c o m

    jLabel12.setHorizontalAlignment(SwingConstants.LEFT);
    jLabel12.setText("<html>www.convcao.com<br>version 0.01</html>");
    jLabel12.setToolTipText("");
    jLabel12.setHorizontalTextPosition(SwingConstants.RIGHT);

    GroupLayout jPanel1Layout = new GroupLayout(jPanel1);
    jPanel1.setLayout(jPanel1Layout);
    jPanel1Layout.setHorizontalGroup(jPanel1Layout.createParallelGroup(GroupLayout.Alignment.LEADING)
            .addComponent(jLabel11, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addGroup(GroupLayout.Alignment.TRAILING,
                    jPanel1Layout.createSequentialGroup().addGap(0, 19, Short.MAX_VALUE).addComponent(jLabel12,
                            GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)));
    jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                    .addComponent(jLabel11, GroupLayout.PREFERRED_SIZE, 45, GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED).addComponent(jLabel12,
                            GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                    .addGap(0, 0, Short.MAX_VALUE)));

    jLabel2.setFont(new Font("Tahoma", 0, 10)); // NOI18N
    jLabel2.setText("Unique ID");

    jTextPane1.setEditable(true);
    jScrollPane1.setViewportView(jTextPane1);
    //jTextPane1.getAccessibleContext().setAccessibleName("");

    renewButton.setText("RENEW");
    renewButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            renewButtonActionPerformed(evt);
        }
    });

    jLabel4.setFont(new Font("Tahoma", 0, 12)); // NOI18N
    jLabel4.setText("Username");

    jTextField1.setText("FTPUser");

    jLabel5.setFont(new Font("Tahoma", 0, 12)); // NOI18N
    jLabel5.setText("Password");

    jPasswordField1.setText("FTPUser123");

    connectButton.setText("Connect");
    connectButton.setEnabled(false);
    connectButton.setActionCommand("connect");
    connectButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            try {
                connectButtonActionPerformed(evt);
            } catch (FileNotFoundException | UnsupportedEncodingException e) {
                e.printStackTrace();
            } catch (SocketException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    });

    jTextArea1.setEditable(false);
    jTextArea1.setColumns(20);
    jTextArea1.setRows(5);
    jScrollPane2.setViewportView(jTextArea1);

    jLabel7.setFont(new Font("Tahoma", 0, 12)); // NOI18N
    jLabel7.setText("Command Monitor");

    jButton1.setFont(new Font("Tahoma", 1, 12)); // NOI18N
    jButton1.setText("START");
    jButton1.setEnabled(false);
    jButton1.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            startButtonActionPerformed(evt);
        }
    });

    jButton2.setFont(new Font("Tahoma", 1, 12)); // NOI18N
    jButton2.setText("STOP");
    jButton2.setEnabled(false);
    jButton2.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            stopButtonActionPerformed(evt);
        }
    });

    jLabel1.setForeground(new Color(255, 0, 0));
    jLabel1.setHorizontalAlignment(SwingConstants.CENTER);
    jLabel1.setText(
            "<html>Click HERE to activate the web service using your ID<br>When the web application is ready, press Start </html>");
    jLabel1.setCursor(new Cursor(Cursor.HAND_CURSOR));
    jLabel1.addMouseListener(new MouseAdapter() {
        public void mouseClicked(MouseEvent evt) {
            try {
                jLabel1MouseClicked(evt);
            } catch (URISyntaxException | IOException e) {
                e.printStackTrace();
            }
        }
    });

    //jLabel9.setText("Working...");
    jLabel9.setIcon(runIcon);
    jLabel9.setVisible(false);

    jLabel10.setText("---");

    jLabel6.setForeground(new Color(0, 204, 0));
    jLabel6.setHorizontalAlignment(SwingConstants.CENTER);
    jLabel6.setText("---");

    GroupLayout jPanel2Layout = new GroupLayout(jPanel2);
    jPanel2.setLayout(jPanel2Layout);
    jPanel2Layout.setHorizontalGroup(jPanel2Layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(
            GroupLayout.Alignment.TRAILING,
            jPanel2Layout.createSequentialGroup().addGroup(jPanel2Layout
                    .createParallelGroup(GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel2Layout.createSequentialGroup().addContainerGap().addComponent(jLabel6,
                            GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addGroup(GroupLayout.Alignment.LEADING, jPanel2Layout.createSequentialGroup()
                            .addGroup(jPanel2Layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                                    .addGroup(jPanel2Layout.createSequentialGroup().addGap(126, 126, 126)
                                            .addComponent(jLabel7, GroupLayout.PREFERRED_SIZE, 110,
                                                    GroupLayout.PREFERRED_SIZE))
                                    .addGroup(jPanel2Layout.createSequentialGroup().addGap(23, 23, 23)
                                            .addGroup(jPanel2Layout
                                                    .createParallelGroup(GroupLayout.Alignment.TRAILING)
                                                    .addGroup(jPanel2Layout
                                                            .createParallelGroup(GroupLayout.Alignment.LEADING,
                                                                    false)
                                                            .addGroup(GroupLayout.Alignment.TRAILING,
                                                                    jPanel2Layout.createSequentialGroup()
                                                                            .addComponent(jLabel9,
                                                                                    GroupLayout.PREFERRED_SIZE,
                                                                                    56,
                                                                                    GroupLayout.PREFERRED_SIZE)
                                                                            .addPreferredGap(
                                                                                    LayoutStyle.ComponentPlacement.RELATED,
                                                                                    GroupLayout.DEFAULT_SIZE,
                                                                                    Short.MAX_VALUE)
                                                                            .addComponent(jButton1,
                                                                                    GroupLayout.PREFERRED_SIZE,
                                                                                    80,
                                                                                    GroupLayout.PREFERRED_SIZE)
                                                                            .addGap(29, 29, 29)
                                                                            .addComponent(jButton2,
                                                                                    GroupLayout.PREFERRED_SIZE,
                                                                                    77,
                                                                                    GroupLayout.PREFERRED_SIZE))
                                                            .addComponent(jScrollPane2,
                                                                    GroupLayout.Alignment.TRAILING,
                                                                    GroupLayout.PREFERRED_SIZE, 308,
                                                                    GroupLayout.PREFERRED_SIZE))
                                                    .addComponent(jLabel10, GroupLayout.Alignment.LEADING,
                                                            GroupLayout.PREFERRED_SIZE, 103,
                                                            GroupLayout.PREFERRED_SIZE)
                                                    .addComponent(jLabel1, GroupLayout.PREFERRED_SIZE, 299,
                                                            GroupLayout.PREFERRED_SIZE))))
                            .addGap(0, 0, Short.MAX_VALUE))
                    .addGroup(jPanel2Layout.createSequentialGroup().addGap(0, 0, Short.MAX_VALUE)
                            .addGroup(jPanel2Layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(
                                    GroupLayout.Alignment.TRAILING,
                                    jPanel2Layout.createSequentialGroup()
                                            .addComponent(jLabel2, GroupLayout.PREFERRED_SIZE, 80,
                                                    GroupLayout.PREFERRED_SIZE)
                                            .addGap(18, 18, 18)
                                            .addComponent(jScrollPane1, GroupLayout.PREFERRED_SIZE, 130,
                                                    GroupLayout.PREFERRED_SIZE)
                                            .addGap(18, 18, 18).addComponent(renewButton))
                                    .addGroup(GroupLayout.Alignment.TRAILING,
                                            jPanel2Layout.createSequentialGroup().addGroup(jPanel2Layout
                                                    .createParallelGroup(GroupLayout.Alignment.LEADING, false)
                                                    .addGroup(jPanel2Layout.createSequentialGroup()
                                                            .addComponent(jLabel4, GroupLayout.PREFERRED_SIZE,
                                                                    64, GroupLayout.PREFERRED_SIZE)
                                                            .addGap(18, 18, 18).addComponent(jTextField1,
                                                                    GroupLayout.PREFERRED_SIZE, 130,
                                                                    GroupLayout.PREFERRED_SIZE))
                                                    .addGroup(jPanel2Layout.createSequentialGroup()
                                                            .addComponent(jLabel5, GroupLayout.PREFERRED_SIZE,
                                                                    64, GroupLayout.PREFERRED_SIZE)
                                                            .addGap(18, 18, 18).addComponent(jPasswordField1)))
                                                    .addGap(14, 14, 14).addComponent(connectButton)))))
                    .addContainerGap()));
    jPanel2Layout.setVerticalGroup(jPanel2Layout.createParallelGroup(GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                    .addGroup(jPanel2Layout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
                            .addComponent(renewButton, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE,
                                    Short.MAX_VALUE)
                            .addComponent(jScrollPane1)
                            .addComponent(jLabel2, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE))
                    .addGap(18, 18, 18)
                    .addGroup(jPanel2Layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel4, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE,
                                    Short.MAX_VALUE)
                            .addComponent(jTextField1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                                    GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jPanel2Layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel5, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE,
                                    Short.MAX_VALUE)
                            .addComponent(jPasswordField1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                                    GroupLayout.PREFERRED_SIZE)
                            .addComponent(connectButton, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE,
                                    Short.MAX_VALUE))
                    .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                    .addComponent(jLabel6, GroupLayout.PREFERRED_SIZE, 21, GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(jLabel1)
                    .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jLabel7, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jScrollPane2, GroupLayout.PREFERRED_SIZE, 113, GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jPanel2Layout.createParallelGroup(GroupLayout.Alignment.TRAILING, false)
                            .addComponent(jButton2, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE,
                                    Short.MAX_VALUE)
                            .addComponent(jButton1, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE,
                                    Short.MAX_VALUE)
                            .addComponent(jLabel9, GroupLayout.PREFERRED_SIZE, 33, GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jLabel10, GroupLayout.PREFERRED_SIZE, 26, GroupLayout.PREFERRED_SIZE)
                    .addGap(5, 5, 5)));

    jLabel1.getAccessibleContext().setAccessibleName("jLabel1");

    jLabel3.setFont(new Font("Tahoma", 1, 22)); // NOI18N
    jLabel3.setText("Real Time Navigation");

    jLabel8.setIcon(appLogo);

    GroupLayout layout = new GroupLayout(jPanelMain);
    jPanelMain.setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup().addContainerGap().addComponent(jLabel3)
                    .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addGroup(layout.createSequentialGroup()
                    .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                            .addComponent(jPanel1, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE,
                                    Short.MAX_VALUE)
                            .addComponent(jLabel8, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE,
                                    Short.MAX_VALUE))
                    .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jPanel2, GroupLayout.PREFERRED_SIZE, 331, GroupLayout.PREFERRED_SIZE)
                    .addContainerGap()));
    layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(layout
            .createSequentialGroup().addComponent(jLabel3)
            .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
            .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                            .addComponent(jLabel8, GroupLayout.PREFERRED_SIZE, 110, GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(jPanel1,
                                    GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addComponent(jPanel2, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addContainerGap()));

    addMenuItem("Settings>Noptilus>Coordinate Settings",
            ImageUtils.getIcon(PluginUtils.getPluginIcon(getClass())), new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    PluginUtils.editPluginProperties(coords, true);
                    coords.saveProps();
                }
            });

    addMenuItem("Settings>Noptilus>ConvCAO Settings", ImageUtils.getIcon(PluginUtils.getPluginIcon(getClass())),
            new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    PluginUtils.editPluginProperties(ConvcaoNeptusInteraction.this, true);
                }
            });

    addMenuItem("Settings>Noptilus>Force vehicle depth",
            ImageUtils.getIcon(PluginUtils.getPluginIcon(getClass())), new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    if (positions.isEmpty()) {
                        GuiUtils.errorMessage(getConsole(), "Force vehicle depth",
                                "ConvCAO control is not active");
                        return;
                    }
                    String[] choices = nameTable.values().toArray(new String[0]);

                    String vehicle = (String) JOptionPane.showInputDialog(getConsole(), "Force vehicle depth",
                            "Choose vehicle", JOptionPane.QUESTION_MESSAGE, null, choices, choices[0]);

                    if (vehicle != null) {
                        double depth = depths.get(vehicle);
                        String newDepth = JOptionPane.showInputDialog(getConsole(), "New depth", "" + depth);
                        try {
                            double dd = Double.parseDouble(newDepth);
                            depths.put(vehicle, dd);
                        } catch (Exception ex) {
                            GuiUtils.errorMessage(getConsole(), ex);
                        }
                    }
                }
            });

    add(jPanelMain);

    renewButtonActionPerformed(null);
}