Example usage for javax.swing JPopupMenu JPopupMenu

List of usage examples for javax.swing JPopupMenu JPopupMenu

Introduction

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

Prototype

public JPopupMenu() 

Source Link

Document

Constructs a JPopupMenu without an "invoker".

Usage

From source file:edu.ku.brc.af.ui.forms.ResultSetController.java

/**
 * /*from  w w  w. jav a 2 s  .c o  m*/
 */
protected JPopupMenu createPopupMenu() {
    JPopupMenu popupMenu = new JPopupMenu();
    JMenuItem mi = UIHelper.createLocalizedMenuItem("Go to Record", null, null, true, new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            showGotoRecDlg();
        }
    });
    popupMenu.add(mi);
    return popupMenu;
}

From source file:edu.ku.brc.specify.tasks.subpane.images.ImagesPane.java

/**
 * Shows the Reset menu.// ww w  . jav a  2 s  . com
 * @param e the mouse event
 */
private void showContextMenu(final MouseEvent e) {
    if (e.isPopupTrigger()) {
        JPopupMenu popup = new JPopupMenu();
        JMenuItem menuItem = new JMenuItem(UIRegistry.getResourceString("ES_TEXT_RESET"));
        menuItem.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent ex) {
                searchText.setEnabled(true);
                searchText.setBackground(textBGColor);
                searchText.setText("");
            }
        });
        popup.add(menuItem);
        popup.show(e.getComponent(), e.getX(), e.getY());

    }
}

From source file:net.sf.jabref.gui.maintable.MainTableSelectionListener.java

/**
 * Method to handle a single left click on one the special fields (e.g., ranking, quality, ...)
 * Shows either a popup to select/clear a value or simply toggles the functionality to set/unset the special field
 *
 * @param e MouseEvent used to determine the position of the popups
 * @param columnName the name of the specialfield column
 *//*from w  w w.ja v  a  2  s.  c  om*/
private void handleSpecialFieldLeftClick(MouseEvent e, String columnName) {
    if ((e.getClickCount() == 1)) {
        SpecialFieldsUtils.getSpecialFieldInstanceFromFieldName(columnName).ifPresent(field -> {
            // special field found
            if (field.isSingleValueField()) {
                // directly execute toggle action instead of showing a menu with one action
                field.getValues().get(0).getAction(panel.frame()).action();
            } else {
                JPopupMenu menu = new JPopupMenu();
                for (SpecialFieldValue val : field.getValues()) {
                    menu.add(val.getMenuAction(panel.frame()));
                }
                menu.show(table, e.getX(), e.getY());
            }
        });
    }
}

From source file:corelyzer.ui.CorelyzerGLCanvas.java

void createPopupMenuUI() {
    JPopupMenu.setDefaultLightWeightPopupEnabled(false);
    this.scenePopupMenu = new JPopupMenu();

    JMenuItem trackName = new JMenuItem("Track Name");
    trackName.setEnabled(false);/*from www  .  jav a  2s.co m*/
    this.scenePopupMenu.add(trackName);

    JMenuItem sectionName = new JMenuItem("Section name");
    sectionName.setEnabled(false);
    this.scenePopupMenu.add(sectionName);

    this.scenePopupMenu.addSeparator();

    // Mode menu
    JMenu modeMenu = new JMenu("Mode");
    ButtonGroup modeGroup = new ButtonGroup();
    this.normalMode = new JRadioButtonMenuItem("Normal mode");
    this.normalMode.setIcon(new ImageIcon(getClass().getResource("/corelyzer/ui/resources/normal.gif")));
    this.normalMode.addActionListener(new ActionListener() {

        public void actionPerformed(final ActionEvent event) {
            CorelyzerApp.getApp().getToolFrame().setMode(0);
        }
    });
    this.normalMode.setSelected(true);
    modeGroup.add(this.normalMode);
    modeMenu.add(this.normalMode);

    this.clastMode = new JRadioButtonMenuItem("Create annotation mode");
    this.clastMode.setIcon(new ImageIcon(getClass().getResource("/corelyzer/ui/resources/copyright.gif")));
    this.clastMode.addActionListener(new ActionListener() {

        public void actionPerformed(final ActionEvent event) {
            CorelyzerApp.getApp().getToolFrame().setMode(3);
        }
    });
    modeGroup.add(this.clastMode);
    modeMenu.add(this.clastMode);

    this.markerMode = new JRadioButtonMenuItem("Modify annotation marker mode");
    this.markerMode.setIcon(new ImageIcon(getClass().getResource("/corelyzer/ui/resources/marker.gif")));
    this.markerMode.addActionListener(new ActionListener() {

        public void actionPerformed(final ActionEvent event) {
            CorelyzerApp.getApp().getToolFrame().setMode(2);
        }
    });
    modeGroup.add(this.markerMode);
    modeMenu.add(this.markerMode);

    this.measureMode = new JRadioButtonMenuItem("Measure mode");
    this.measureMode.setIcon(new ImageIcon(getClass().getResource("/corelyzer/ui/resources/ruler.gif")));
    this.measureMode.addActionListener(new ActionListener() {

        public void actionPerformed(final ActionEvent event) {
            CorelyzerApp.getApp().getToolFrame().setMode(1);
        }
    });
    modeGroup.add(this.measureMode);
    modeMenu.add(this.measureMode);

    this.cutMode = new JRadioButtonMenuItem("Cut mode");
    this.cutMode.setIcon(new ImageIcon(getClass().getResource("/corelyzer/ui/resources/cut.gif")));
    this.cutMode.addActionListener(new ActionListener() {

        public void actionPerformed(final ActionEvent event) {
            CorelyzerApp.getApp().getToolFrame().setMode(4);
        }
    });
    modeGroup.add(this.cutMode);
    modeMenu.add(this.cutMode);

    this.scenePopupMenu.add(modeMenu);

    JMenuItem hideTrackMenuItem = new JMenuItem("Hide track");
    hideTrackMenuItem.addActionListener(new ActionListener() {

        public void actionPerformed(final ActionEvent event) {
            doHideTrack();
        }
    });
    this.scenePopupMenu.add(hideTrackMenuItem);

    JMenuItem exportTrackMenuItem = new JMenuItem("Export track");
    exportTrackMenuItem.addActionListener(new ActionListener() {

        public void actionPerformed(final ActionEvent actionEvent) {
            doExportTrack();
        }
    });
    this.scenePopupMenu.add(exportTrackMenuItem);

    JMenuItem lockSectionMenuItem = new JCheckBoxMenuItem("Lock Section");
    lockSectionMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent actionEvent) {
            AbstractButton b = (AbstractButton) actionEvent.getSource();
            doLockSection(b.getModel().isSelected());
        }
    });

    JMenuItem lockSectionGraphMenuItem = new JCheckBoxMenuItem("Lock Section Graphs");
    lockSectionGraphMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent actionEvent) {
            AbstractButton b = (AbstractButton) actionEvent.getSource();
            doLockSectionGraph(b.getModel().isSelected());
        }
    });

    JMenuItem graphMenuItem = new JMenuItem("Graph...");
    graphMenuItem.addActionListener(new ActionListener() {

        public void actionPerformed(final ActionEvent event) {
            doGraphDialog();
        }
    });

    this.propertyMenuItem = new JMenuItem("Properties...");
    this.propertyMenuItem.addActionListener(new ActionListener() {

        public void actionPerformed(final ActionEvent event) {
            SectionImagePropertyDialog dialog = new SectionImagePropertyDialog(canvas);
            dialog.setProperties(selectedTrack, selectedTrackSection);
            dialog.pack();
            dialog.setLocationRelativeTo(canvas);
            dialog.setVisible(true);
            dialog.dispose();
        }
    });

    splitMenuItem = new JMenuItem("Split...");
    splitMenuItem.addActionListener(new ActionListener() {

        public void actionPerformed(final ActionEvent e) {
            CorelyzerApp app = CorelyzerApp.getApp();
            if (app != null) {
                app.getController().sectionSplit();
            }
        }
    });

    JMenuItem deleteItem = new JMenuItem("Delete...");
    deleteItem.addActionListener(new ActionListener() {

        public void actionPerformed(final ActionEvent actionEvent) {
            doDeleteSection();
        }
    });

    JMenuItem staggerSectionsItem = new JCheckBoxMenuItem("Stagger Sections", false);
    staggerSectionsItem.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent e) {
            AbstractButton b = (AbstractButton) e.getSource();
            doStaggerSections(b.getModel().isSelected());
        }
    });

    JMenuItem trimSectionsItem = new JMenuItem("Trim Sections...");
    trimSectionsItem.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent e) {
            doTrimSections();
        }
    });

    JMenuItem stackSectionsItem = new JMenuItem("Stack Sections");
    stackSectionsItem.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent e) {
            doStackSections();
        }
    });

    this.scenePopupMenu.addSeparator();
    this.scenePopupMenu.add(lockSectionMenuItem);
    this.scenePopupMenu.add(lockSectionGraphMenuItem);
    this.scenePopupMenu.addSeparator();
    this.scenePopupMenu.add(graphMenuItem);
    this.scenePopupMenu.add(splitMenuItem);
    this.scenePopupMenu.add(propertyMenuItem);
    this.scenePopupMenu.add(deleteItem);
    this.scenePopupMenu.add(staggerSectionsItem);
    this.scenePopupMenu.add(trimSectionsItem);
    this.scenePopupMenu.add(stackSectionsItem);

    CorelyzerApp.getApp().getPluginManager().addPluginPopupSubMenus(this.scenePopupMenu);
}

From source file:org.eurocarbdb.application.glycoworkbench.plugin.AnnotationReportApplet.java

protected JPopupMenu createPopupMenu() {

    JPopupMenu menu = new JPopupMenu();

    menu.add(theActionManager.get("zoomnone"));
    menu.add(theActionManager.get("zoomin"));
    menu.add(theActionManager.get("zoomout"));

    menu.addSeparator();//from  w  w  w.ja v a 2 s .c  om

    menu.add(theActionManager.get("cut"));
    menu.add(theActionManager.get("copy"));
    menu.add(theActionManager.get("delete"));

    menu.addSeparator();

    menu.add(theActionManager.get("enlarge"));
    menu.add(theActionManager.get("resetsize"));
    menu.add(theActionManager.get("shrink"));

    menu.addSeparator();

    menu.add(theActionManager.get("group"));
    menu.add(theActionManager.get("ungroup"));

    return menu;
}

From source file:gdt.jgui.entity.fields.JFieldsFacetOpenItem.java

/**
 * Get the popup menu for the child node of the facet node 
 * in the digest view.//from w w  w.  jav  a 2  s  . c o m
 * @return the popup menu.   
 */
@Override
public JPopupMenu getPopupMenu(final String digestLocator$) {
    System.out.println("JFieldsFacetOpenItem:getPopupMenu:digest locator="
            + Locator.remove(digestLocator$, Locator.LOCATOR_ICON));
    JPopupMenu popup = new JPopupMenu();
    JMenuItem editItem = new JMenuItem("Edit");
    popup.add(editItem);
    editItem.setHorizontalTextPosition(JMenuItem.RIGHT);
    editItem.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            try {
                Properties locator = Locator.toProperties(digestLocator$);
                String encodedSelection$ = locator.getProperty(JEntityDigestDisplay.SELECTION);
                byte[] ba = Base64.decodeBase64(encodedSelection$);
                String selection$ = new String(ba, "UTF-8");
                locator = Locator.toProperties(selection$);
                String entihome$ = locator.getProperty(Entigrator.ENTIHOME);
                String entityKey$ = locator.getProperty(EntityHandler.ENTITY_KEY);
                String nodeType$ = locator.getProperty(JEntityDigestDisplay.NODE_TYPE);
                System.out.println("JFieldsFacetOpenItem:getPopupMenu:node type:" + nodeType$);
                Entigrator entigrator = console.getEntigrator(entihome$);
                //      Sack entity=entigrator.getEntityAtKey(entityKey$);
                if (NODE_TYPE_FIELD_NAME.equals(nodeType$)) {
                    String fieldName$ = locator.getProperty(Locator.LOCATOR_TITLE);
                    JTextEditor te = new JTextEditor();
                    String teLocator$ = te.getLocator();
                    teLocator$ = Locator.append(teLocator$, JTextEditor.TEXT, fieldName$);
                    if (entihome$ != null)
                        teLocator$ = Locator.append(teLocator$, Entigrator.ENTIHOME, entihome$);
                    if (entityKey$ != null)
                        teLocator$ = Locator.append(teLocator$, EntityHandler.ENTITY_KEY, entityKey$);

                    String foiLocator$ = getLocator();
                    foiLocator$ = Locator.append(foiLocator$, BaseHandler.HANDLER_METHOD, METHOD_RESPONSE);
                    foiLocator$ = Locator.append(foiLocator$, JRequester.REQUESTER_ACTION, ACTION_DIGEST_CALL);
                    foiLocator$ = Locator.append(foiLocator$, FIELD_NAME, fieldName$);
                    foiLocator$ = Locator.append(foiLocator$, JRequester.REQUESTER_RESPONSE_LOCATOR,
                            Locator.compressText(digestLocator$));
                    if (entihome$ != null)
                        foiLocator$ = Locator.append(foiLocator$, Entigrator.ENTIHOME, entihome$);
                    if (entityKey$ != null)
                        foiLocator$ = Locator.append(foiLocator$, EntityHandler.ENTITY_KEY, entityKey$);
                    System.out.println("JFieldsFacetOpenItem:getPopupMenu:name:locator=" + foiLocator$);
                    teLocator$ = Locator.append(teLocator$, JRequester.REQUESTER_RESPONSE_LOCATOR,
                            Locator.compressText(foiLocator$));
                    JConsoleHandler.execute(console, teLocator$);
                    System.out.println("JFieldsFacetOpenItem:getPopupMenu:teLocator=" + teLocator$);
                    return;
                }
                if (NODE_TYPE_FIELD_VALUE.equals(nodeType$)) {
                    String fieldName$ = locator.getProperty(Locator.LOCATOR_TITLE);
                    JTextEditor te = new JTextEditor();
                    String teLocator$ = te.getLocator();
                    teLocator$ = Locator.append(teLocator$, JTextEditor.TEXT, fieldName$);
                    if (entihome$ != null)
                        teLocator$ = Locator.append(teLocator$, Entigrator.ENTIHOME, entihome$);
                    if (entityKey$ != null)
                        teLocator$ = Locator.append(teLocator$, EntityHandler.ENTITY_KEY, entityKey$);

                    String foiLocator$ = getLocator();
                    foiLocator$ = Locator.append(foiLocator$, BaseHandler.HANDLER_METHOD, METHOD_RESPONSE);
                    foiLocator$ = Locator.append(foiLocator$, JRequester.REQUESTER_ACTION, ACTION_DIGEST_CALL);
                    foiLocator$ = Locator.append(foiLocator$, FIELD_NAME, fieldName$);
                    foiLocator$ = Locator.append(foiLocator$, JRequester.REQUESTER_RESPONSE_LOCATOR,
                            Locator.compressText(digestLocator$));
                    if (entihome$ != null)
                        foiLocator$ = Locator.append(foiLocator$, Entigrator.ENTIHOME, entihome$);
                    if (entityKey$ != null)
                        foiLocator$ = Locator.append(foiLocator$, EntityHandler.ENTITY_KEY, entityKey$);
                    System.out.println("JFieldsFacetOpenItem:getPopupMenu:value:locator=" + foiLocator$);

                    teLocator$ = Locator.append(teLocator$, JRequester.REQUESTER_RESPONSE_LOCATOR,
                            Locator.compressText(foiLocator$));
                    JConsoleHandler.execute(console, teLocator$);
                    return;
                }
                if (JEntityDigestDisplay.NODE_TYPE_FACET_OWNER.equals(nodeType$)) {
                    JEntityDigestDisplay edd = new JEntityDigestDisplay();
                    String eddLocator$ = edd.getLocator();
                    eddLocator$ = Locator.append(eddLocator$, Entigrator.ENTIHOME, entihome$);
                    eddLocator$ = Locator.append(eddLocator$, EntityHandler.ENTITY_KEY, entityKey$);
                    eddLocator$ = Locator.append(eddLocator$, JEntityDigestDisplay.SELECTION,
                            encodedSelection$);
                    String requesterResponseLocator$ = Locator.compressText(eddLocator$);
                    JFieldsEditor fieldsEditor = new JFieldsEditor();
                    String feLocator$ = fieldsEditor.getLocator();
                    feLocator$ = Locator.append(feLocator$, Entigrator.ENTIHOME, entihome$);
                    feLocator$ = Locator.append(feLocator$, EntityHandler.ENTITY_KEY, entityKey$);
                    feLocator$ = Locator.append(feLocator$, JRequester.REQUESTER_RESPONSE_LOCATOR,
                            requesterResponseLocator$);
                    feLocator$ = Locator.append(feLocator$, BaseHandler.HANDLER_METHOD, "instantiate");
                    JConsoleHandler.execute(console, feLocator$);
                }
            } catch (Exception ee) {
                Logger.getLogger(JFieldsFacetOpenItem.class.getName()).info(ee.toString());
            }
        }
    });
    return popup;
}

From source file:maltcms.ui.fileHandles.csv.CSVTableView.java

private void createAndShowPopupMenu(MouseEvent me) {
    if (me.getButton() == MouseEvent.BUTTON3 && this.jTable1.getSelectedRowCount() > 0 && this.jfctc != null) {

        JPopupMenu jpm = new JPopupMenu();

        //more than one column selected
        if (jTable1.getSelectedColumnCount() > 0) {
            jpm.add(new AbstractAction("Add as y-values") {

                @Override/*from w w  w.j  av  a 2 s . c  o  m*/
                public void actionPerformed(ActionEvent ae) {
                    for (int col : jTable1.getSelectedColumns()) {
                        columnsToPlot.add(col);
                        jTable1.getColumnModel().getColumn(col).setCellRenderer(new ColorColumnRenderer(
                                new Color(238, 187, 0, 255), jTable1.getSelectedRows()));
                    }
                    jfctc.setChart(
                            buildChart(labelColumn, domainColumn, columnsToPlot, jTable1.getSelectedRows()));
                }
            });
            //selected rows
            for (final int col : jTable1.getSelectedColumns()) {
                if (columnsToPlot.contains(col)) {
                    jpm.add(new AbstractAction("Remove y-values from chart") {

                        @Override
                        public void actionPerformed(ActionEvent ae) {
                            jTable1.getColumnModel().getColumn(col).setCellRenderer(
                                    new ColorColumnRenderer(Color.WHITE, jTable1.getSelectedRows()));
                            columnsToPlot.remove(col);
                            jfctc.setChart(buildChart(labelColumn, domainColumn, columnsToPlot,
                                    jTable1.getSelectedRows()));
                        }
                    });
                    break;
                }
            }
            jpm.add(new JPopupMenu.Separator());
            jpm.add(new AbstractAction("Log10 transform") {

                @Override
                public void actionPerformed(ActionEvent ae) {
                    final int[] cols = jTable1.getSelectedColumns();
                    for (int i = 0; i < jTable1.getSelectedColumnCount(); i++) {
                        logTransformColumn(cols[i], 10.0d);
                    }

                }
            });
            jpm.add(new AbstractAction("Inverse Log10 transform") {

                @Override
                public void actionPerformed(ActionEvent ae) {
                    final int[] cols = jTable1.getSelectedColumns();
                    for (int i = 0; i < jTable1.getSelectedColumnCount(); i++) {
                        inverseLogTransformColumn(cols[i], 10.0d);
                    }

                }
            });
        }
        jpm.add(new JPopupMenu.Separator());
        //exactly one selected column, no domain column
        if (jTable1.getSelectedColumnCount() == 1 && domainColumn == -1) {
            jpm.add(new AbstractAction("Set as x-values") {

                @Override
                public void actionPerformed(ActionEvent ae) {
                    domainColumn = jTable1.getSelectedColumn();
                    jTable1.getColumnModel().getColumn(domainColumn).setCellRenderer(
                            new ColorColumnRenderer(new Color(255, 0, 0, 255), jTable1.getSelectedRows()));
                    jfctc.setChart(
                            buildChart(labelColumn, domainColumn, columnsToPlot, jTable1.getSelectedRows()));
                }
            });

        }
        //one domainColumn
        if (domainColumn != -1) {
            jpm.add(new AbstractAction("Reset x-axis values") {

                @Override
                public void actionPerformed(ActionEvent ae) {
                    jTable1.getColumnModel().getColumn(domainColumn).setCellRenderer(
                            new ColorColumnRenderer(new Color(255, 255, 255, 255), jTable1.getSelectedRows()));
                    domainColumn = -1;
                    jfctc.setChart(
                            buildChart(labelColumn, domainColumn, columnsToPlot, jTable1.getSelectedRows()));
                }
            });
        }
        jpm.add(new JPopupMenu.Separator());
        if (jTable1.getSelectedColumnCount() == 1 && labelColumn == -1) {
            jpm.add(new AbstractAction("Set as series labels") {

                @Override
                public void actionPerformed(ActionEvent ae) {
                    labelColumn = jTable1.getSelectedColumn();
                    jTable1.getColumnModel().getColumn(labelColumn).setCellRenderer(
                            new ColorColumnRenderer(new Color(255, 255, 0, 255), jTable1.getSelectedRows()));
                    jfctc.setChart(
                            buildChart(labelColumn, domainColumn, columnsToPlot, jTable1.getSelectedRows()));
                }
            });
        }

        if (jTable1.getSelectedColumnCount() == 1 && labelColumn != -1) {
            jpm.add(new AbstractAction("Reset series labels") {

                @Override
                public void actionPerformed(ActionEvent ae) {
                    jTable1.getColumnModel().getColumn(labelColumn).setCellRenderer(
                            new ColorColumnRenderer(new Color(255, 255, 255, 255), jTable1.getSelectedRows()));
                    labelColumn = -1;
                    jfctc.setChart(
                            buildChart(labelColumn, domainColumn, columnsToPlot, jTable1.getSelectedRows()));
                }
            });
        }

        jpm.show(me.getComponent(), me.getX(), me.getY());
    }
}

From source file:gov.noaa.ncdc.iosp.avhrr.util.AvhrrLevel1B2Netcdf.java

/**
 * This method is called from within the constructor to initialize the form.
 * WARNING: Do NOT modify this code. The content of this method is always
 * regenerated by the Form Editor.//from w  w  w . j  a  va 2 s  .  c o  m
 */
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
    // Create a file chooser
    this.setTitle("NCDC sat2netcdf converter");

    aboutDialog = new javax.swing.JDialog();
    aboutButton = new javax.swing.JButton();
    aboutLabel = new javax.swing.JLabel();
    aboutDialog.setTitle("About");
    aboutDialog.setName("aboutDialog"); // NOI18N
    aboutDialog.setSize(250, 200);

    aboutButton.setText("OK");
    aboutButton.setName("aboutButton"); // NOI18N
    aboutButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            aboutDialog.hide();
        }
    });

    aboutLabel.setText(
            "<html>\nNCDC sat2netcdf Converter<br> </br>\nCopyright (c) 2008 Work of U.S. Government.<br></br>\nNCDC<br></br>\nContact: ncdc.satorder@noaa.gov\n</html>");

    fc = new JFileChooser();
    fc.setMultiSelectionEnabled(true);

    // output directory file chooser
    outFc = new JFileChooser();
    outFc.setMultiSelectionEnabled(false);
    outFc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);

    activityMonitor = new Timer(100, new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            convertMonitorActionPerformed(evt);
        }
    });

    menuBar = new JMenuBar();
    logMenu = new JMenu("Log");

    logMenuItem = new JMenuItem("View Log");
    logMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            logDialog.show();
        }
    });
    logMenu.add(logMenuItem);

    menuBar.add(logMenu);
    helpMenu = new JMenu("Help");
    menuBar.add(helpMenu);

    helpMenuItem = new JMenuItem("Help");
    helpMenuItem.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            helpMenuActionPerformed(evt);
        }
    });
    helpMenu.add(helpMenuItem);
    aboutMenuItem = new JMenuItem("About");
    aboutMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            aboutDialog.show();
        }
    });
    helpMenu.add(aboutMenuItem);

    this.setJMenuBar(menuBar);

    jButton4 = new javax.swing.JButton();
    openButton = new javax.swing.JButton();
    jScrollPane1 = new javax.swing.JScrollPane();
    jTable1 = new javax.swing.JTable();
    jLabel1 = new javax.swing.JLabel();
    outdirButton = new javax.swing.JButton();
    outdirText = new javax.swing.JTextField();
    jPanel1 = new javax.swing.JPanel();
    allChanCheckBox = new javax.swing.JCheckBox();
    jLabel3 = new javax.swing.JLabel();
    jLabel4 = new javax.swing.JLabel();
    jLabel5 = new javax.swing.JLabel();
    chan1CheckBox = new javax.swing.JCheckBox();
    chan2CheckBox = new javax.swing.JCheckBox();
    chan3CheckBox = new javax.swing.JCheckBox();
    chan4CheckBox = new javax.swing.JCheckBox();
    chan5CheckBox = new javax.swing.JCheckBox();
    rawCheckBox = new javax.swing.JCheckBox();
    radCheckBox = new javax.swing.JCheckBox();
    tempCheckBox = new javax.swing.JCheckBox();
    allVarCheckBox = new javax.swing.JCheckBox();
    qualityCheckBox = new javax.swing.JCheckBox();
    calCheckBox = new javax.swing.JCheckBox();
    latlonCheckBox = new javax.swing.JCheckBox();
    metaCheckBox = new javax.swing.JCheckBox();
    jLabel2 = new javax.swing.JLabel();
    jLabel6 = new javax.swing.JLabel();
    convertButton = new javax.swing.JButton();
    exitButton = new javax.swing.JButton();

    jButton4.setText("jButton4");

    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

    openButton.setText("Select Files");
    openButton.setName("selectButton"); // NOI18N
    openButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            openButtonActionPerformed(evt);
        }
    });

    fm = new FileModel();
    jTable1 = new JTable(fm);
    jTable1.setName("table"); // NOI18N
    jTable1.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
    setTableCellRenderer(jTable1, new ToolCellRenderer());
    // remove popup for table
    removeItem = new JMenuItem("Remove");
    removeItem.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            int[] selected = jTable1.getSelectedRows();
            for (int i : selected) {
                logTextArea.append("Removed File: " + fm.getFileAtRow(i).getName() + "\n");
            }
            fm.removeRows(selected);
        }
    });
    popup = new JPopupMenu();
    popup.add(removeItem);
    // Add listener to the jtable so the popup menu can come up.
    // MouseListener popupListener = new PopupListener(jTable1);
    // jTable1.addMouseListener(popupListener);

    jTable1.addMouseListener(new MouseListener() {
        public void mousePressed(MouseEvent e) {
            int button = e.getButton();
            int[] selected = jTable1.getSelectedRows();
            if (button != 1 && selected.length > 0) {
                popup.show(e.getComponent(), e.getX(), e.getY());
            }
        }

        public void mouseClicked(MouseEvent e) {
            int button = e.getButton();
            int column = jTable1.getSelectedColumn();
            if (0 == column && 1 == button) {
                updateOutputSize();
            }
        }

        public void mouseEntered(MouseEvent e) {

        }

        public void mouseExited(MouseEvent e) {

        }

        public void mouseReleased(MouseEvent e) {

        }
    });

    TableColumn col = jTable1.getColumnModel().getColumn(1);
    col.setPreferredWidth(250);
    col = jTable1.getColumnModel().getColumn(3);
    col.setPreferredWidth(100);

    jScrollPane1.setViewportView(jTable1);

    jLabel1.setText("Select output directory");

    outdirButton.setText("Browse");
    outdirButton.setName("outdirButton"); // NOI18N
    outdirButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            outdirButtonActionPerformed(evt);
        }
    });
    outdirText.setName("outdirText"); // NOI18N
    try {
        outdirText.setText(new File(".").getCanonicalPath());
    } catch (IOException ioe) {
        ioe.printStackTrace();
    }

    jPanel1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
    jPanel1.setName("optionPanel"); // NOI18N

    allChanCheckBox.setText("All Channels");
    allChanCheckBox.setSelected(true);
    allChanCheckBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            handleChannelBoxes("jCheckBox1", allChanCheckBox);
            updateFileSize();
        }
    });

    jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    jLabel3.setText("Channels");

    jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    jLabel4.setText("Calibration");
    jLabel4.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);

    jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    jLabel5.setText("Additional Data");
    jLabel5.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);

    chan1CheckBox.setText("Channel 1");
    chan1CheckBox.setSelected(true);
    chan1CheckBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            handleChannelBoxes("chan1CheckBox", chan1CheckBox);
            updateFileSize();
        }
    });
    chan2CheckBox.setText("Channel 2");
    chan2CheckBox.setSelected(true);
    chan2CheckBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            handleChannelBoxes("chan2CheckBox", chan2CheckBox);
            updateFileSize();
        }
    });

    chan3CheckBox.setText("Channel 3A/B");
    chan3CheckBox.setSelected(true);
    chan3CheckBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            handleChannelBoxes("chan3CheckBox", chan3CheckBox);
            updateFileSize();
        }
    });

    chan4CheckBox.setLabel("Channel 4");
    chan4CheckBox.setSelected(true);
    chan4CheckBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            handleChannelBoxes("chan4CheckBox", chan4CheckBox);
            updateFileSize();
        }
    });
    chan5CheckBox.setLabel("Channel 5");
    chan5CheckBox.setSelected(true);
    chan5CheckBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            handleChannelBoxes("chan5CheckBox", chan5CheckBox);
            updateFileSize();
        }
    });
    rawCheckBox.setText("Raw Data");
    rawCheckBox.setSelected(true);
    rawCheckBox.setToolTipText("Counts for each pixel");
    rawCheckBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            handleCalibrationCheckBoxes(rawCheckBox);
            updateFileSize();
        }
    });
    radCheckBox.setText("Radiance");
    radCheckBox.setToolTipText("Radiance Values");
    radCheckBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            handleCalibrationCheckBoxes(radCheckBox);
            updateFileSize();
        }
    });
    tempCheckBox.setText("Brightness Temperature");
    tempCheckBox.setToolTipText("Albedo for visible channels, Brightness Temperature for IR channels");
    tempCheckBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            handleCalibrationCheckBoxes(tempCheckBox);
            updateFileSize();
        }
    });
    allVarCheckBox.setText("All Variables");
    allVarCheckBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            handleAllVariablesCheckBox();
            updateFileSize();
        }
    });
    qualityCheckBox.setText("Quality Flags");
    qualityCheckBox.setToolTipText("Quality Variables");
    qualityCheckBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            handleOtherCheckbox(qualityCheckBox);
            updateFileSize();
        }
    });

    calCheckBox.setText("Calibration Coefficients");
    calCheckBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            handleOtherCheckbox(calCheckBox);
            updateFileSize();
        }
    });

    jLabel2.setText("Select output options");

    convertButton.setText("Convert");
    convertButton.setName("convertButton"); // NOI18N
    convertButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            convertButtonActionPerformed(evt);
        }
    });

    exitButton.setText("Exit");
    exitButton.setName("exitButton"); // NOI18N
    exitButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            exitButtonActionPerformed(evt);
        }
    });

    // help dialog
    helpDialog = new javax.swing.JDialog();
    helpCloseButton = new javax.swing.JButton("Close");
    helpScrollPane = new javax.swing.JScrollPane();

    //      helpEditorPane = new javax.swing.JEditorPane("text/rtf", helpText);
    helpEditorPane = new javax.swing.JEditorPane();
    helpEditorPane.setContentType("text/html");
    InputStream stream = null;
    try {
        stream = AvhrrLevel1B2Netcdf.class.getResourceAsStream("/help.html");
        if (stream != null) {
            helpEditorPane.read(stream, "html");
        }
    } catch (IOException e1) {
        e1.printStackTrace();
    }

    helpScrollPane.setViewportView(helpEditorPane);
    helpDialog.setSize(450, 500);
    helpCloseButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            helpDialog.dispose();
        }
    });

    // Log Dialog
    logDialog = new javax.swing.JDialog();
    logScrollPane = new javax.swing.JScrollPane();
    logTextArea = new javax.swing.JTextArea();
    logCloseButton = new javax.swing.JButton();
    clearButton = new javax.swing.JButton();

    logDialog.setTitle("Log");
    logDialog.setName("logDialog"); // NOI18N
    logDialog.setSize(450, 500);
    logScrollPane.setName("logScrollPane"); // NOI18N

    logTextArea.setColumns(20);
    logTextArea.setRows(5);
    logTextArea.setName("logTextArea"); // NOI18N
    logScrollPane.setViewportView(logTextArea);

    logCloseButton.setText("Close");
    logCloseButton.setName("logCloseButton"); // NOI18N
    logCloseButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            logDialog.hide();
        }
    });

    clearButton.setText("Clear");
    clearButton.setName("clearButton"); // NOI18N
    clearButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            logTextArea.setText("");
        }
    });

    latlonCheckBox.setText("Lat/Lon");
    latlonCheckBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            handleLatLonCheckbox();
            updateFileSize();
        }
    });

    metaCheckBox.setText("Other metadata");
    metaCheckBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            handleMetadataCheckbox();
            updateFileSize();
        }
    });

    jLabel2.setText("Select output options");

    convertButton.setText("Convert");
    convertButton.setName("convertButton");

    exitButton.setText("Exit");
    exitButton.setName("exitButton");
    exitButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            exitButtonActionPerformed(evt);
        }
    });

    jLabel2.setText("Select output options"); // NOI18N

    convertButton.setText("Convert"); // NOI18N
    convertButton.setName("convertButton"); // NOI18N

    exitButton.setText("Exit"); // NOI18N
    exitButton.setName("exitButton"); // NOI18N
    exitButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            exitButtonActionPerformed(evt);
        }
    });

    jLabel6.setFont(new java.awt.Font("Dialog", 1, 11));
    jLabel6.setText("Estimated output size: ");

    org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);
    jPanel1.setLayout(jPanel1Layout);
    jPanel1Layout.setHorizontalGroup(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel1Layout.createSequentialGroup().addContainerGap().add(jPanel1Layout
                    .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(chan5CheckBox)
                    .add(jPanel1Layout.createSequentialGroup().add(jPanel1Layout
                            .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(jPanel1Layout.createSequentialGroup().add(jPanel1Layout
                                    .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                    .add(jPanel1Layout
                                            .createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING,
                                                    false)
                                            .add(org.jdesktop.layout.GroupLayout.LEADING, jLabel3,
                                                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                                    Short.MAX_VALUE)
                                            .add(org.jdesktop.layout.GroupLayout.LEADING, allChanCheckBox,
                                                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                                    Short.MAX_VALUE))
                                    .add(chan1CheckBox).add(chan2CheckBox)).add(36, 36, 36)
                                    .add(jPanel1Layout
                                            .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                                            .add(radCheckBox)
                                            .add(tempCheckBox, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                                    163, Short.MAX_VALUE)
                                            .add(rawCheckBox).add(jLabel4,
                                                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                                    Short.MAX_VALUE)))
                            .add(chan3CheckBox).add(chan4CheckBox))
                            .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                            .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                    .add(metaCheckBox).add(latlonCheckBox).add(allVarCheckBox)
                                    .add(jLabel5, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 113,
                                            org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                    .add(qualityCheckBox).add(calCheckBox))))
                    .add(67, 67, 67)));
    jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel1Layout.createSequentialGroup().addContainerGap()
                    .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jLabel3).add(jLabel5).add(jLabel4,
                                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 21,
                                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                    .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(allChanCheckBox).add(allVarCheckBox).add(rawCheckBox))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(chan1CheckBox).add(qualityCheckBox).add(radCheckBox))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(chan2CheckBox).add(calCheckBox).add(tempCheckBox,
                                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 22,
                                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(chan3CheckBox).add(latlonCheckBox))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(chan4CheckBox).add(metaCheckBox))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(chan5CheckBox)
                    .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

    jLabel2.setText("Select output options"); // NOI18N

    convertButton.setText("Convert"); // NOI18N
    convertButton.setName("convertButton"); // NOI18N

    exitButton.setText("Exit"); // NOI18N
    exitButton.setName("exitButton"); // NOI18N
    exitButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            exitButtonActionPerformed(evt);
        }
    });

    jLabel6.setFont(new java.awt.Font("Dialog", 1, 11));
    jLabel6.setText("Estimated output size: ");

    org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup().addContainerGap()
                    .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(jPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 531, Short.MAX_VALUE)
                            .add(layout.createSequentialGroup().add(outdirButton)
                                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(outdirText,
                                            org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 453, Short.MAX_VALUE))
                            .add(jLabel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 531, Short.MAX_VALUE)
                            .add(openButton)
                            .add(jLabel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 291,
                                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(layout.createSequentialGroup().add(convertButton)
                                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(jLabel6,
                                            org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 442, Short.MAX_VALUE))
                            .add(exitButton).add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                    531, Short.MAX_VALUE))
                    .addContainerGap()));
    layout.setVerticalGroup(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(layout
            .createSequentialGroup().addContainerGap().add(openButton)
            .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
            .add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 173,
                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
            .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(jLabel1)
            .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
            .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(outdirButton).add(
                    outdirText, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 27,
                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
            .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
            .add(jLabel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 15,
                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
            .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
            .add(jPanel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
            .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
            .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false).add(convertButton)
                    .add(jLabel6, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                            org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED).add(exitButton).add(12, 12, 12)));
    // log dialog layout
    org.jdesktop.layout.GroupLayout logDialogLayout = new org.jdesktop.layout.GroupLayout(
            logDialog.getContentPane());
    logDialog.getContentPane().setLayout(logDialogLayout);
    logDialogLayout.setHorizontalGroup(
            logDialogLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(
                    org.jdesktop.layout.GroupLayout.TRAILING,
                    logDialogLayout.createSequentialGroup().addContainerGap()
                            .add(logDialogLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                                    .add(org.jdesktop.layout.GroupLayout.LEADING, logScrollPane,
                                            org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 520, Short.MAX_VALUE)
                                    .add(logDialogLayout.createSequentialGroup().add(clearButton)
                                            .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                                            .add(logCloseButton)))
                            .addContainerGap()));
    logDialogLayout.setVerticalGroup(logDialogLayout
            .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(org.jdesktop.layout.GroupLayout.TRAILING, logDialogLayout.createSequentialGroup()
                    .addContainerGap()
                    .add(logScrollPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 304, Short.MAX_VALUE)
                    .add(18, 18, 18)
                    .add(logDialogLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(logCloseButton).add(clearButton))
                    .addContainerGap()));

    // help dialog layout
    org.jdesktop.layout.GroupLayout helpDialogLayout = new org.jdesktop.layout.GroupLayout(
            helpDialog.getContentPane());
    helpDialog.getContentPane().setLayout(helpDialogLayout);
    helpDialogLayout.setHorizontalGroup(
            helpDialogLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(
                    org.jdesktop.layout.GroupLayout.TRAILING,
                    helpDialogLayout.createSequentialGroup().addContainerGap()
                            .add(helpDialogLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                                    .add(org.jdesktop.layout.GroupLayout.LEADING, helpScrollPane,
                                            org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 520, Short.MAX_VALUE)
                                    .add(helpDialogLayout.createSequentialGroup()
                                            .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                                            .add(helpCloseButton)))
                            .addContainerGap()));
    helpDialogLayout.setVerticalGroup(helpDialogLayout
            .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(org.jdesktop.layout.GroupLayout.TRAILING, helpDialogLayout.createSequentialGroup()
                    .addContainerGap()
                    .add(helpScrollPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 304, Short.MAX_VALUE)
                    .add(18, 18, 18).add(helpDialogLayout
                            .createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE).add(helpCloseButton))
                    .addContainerGap()));

    // about dialog layout
    org.jdesktop.layout.GroupLayout aboutDialogLayout = new org.jdesktop.layout.GroupLayout(
            aboutDialog.getContentPane());
    aboutDialog.getContentPane().setLayout(aboutDialogLayout);
    aboutDialogLayout.setHorizontalGroup(
            aboutDialogLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(
                    org.jdesktop.layout.GroupLayout.TRAILING,
                    aboutDialogLayout.createSequentialGroup().addContainerGap()
                            .add(aboutDialogLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                                    .add(org.jdesktop.layout.GroupLayout.LEADING, aboutLabel,
                                            org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 227, Short.MAX_VALUE)
                                    .add(aboutButton))
                            .addContainerGap()));
    aboutDialogLayout.setVerticalGroup(
            aboutDialogLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(
                    org.jdesktop.layout.GroupLayout.TRAILING,
                    aboutDialogLayout.createSequentialGroup().addContainerGap()
                            .add(aboutLabel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 103,
                                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 35, Short.MAX_VALUE)
                            .add(aboutButton).add(21, 21, 21)));

    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

    pack();

    JOptionPane.showMessageDialog(this,
            "Warning! \nThis program is untested.\nPlease read help file for\nsupported files, limitations and license.\n");
    //            + "Please view Help for more information.");
}

From source file:com.mirth.connect.client.ui.editors.transformer.TransformerPane.java

/**
 * This method is called from within the constructor to initialize the form.
 *///from w  w w . j  av a  2 s .  co m
public void initComponents() {

    // the available panels (cards)
    stepPanel = new BasePanel();
    blankPanel = new BasePanel();

    scriptTextArea = new MirthRTextScrollPane(null, true, SyntaxConstants.SYNTAX_STYLE_JAVASCRIPT, false);
    scriptTextArea.setBackground(new Color(204, 204, 204));
    scriptTextArea.setBorder(BorderFactory.createEtchedBorder());
    scriptTextArea.getTextArea().setEditable(false);
    scriptTextArea.getTextArea().setDropTarget(null);

    generatedScriptPanel = new JPanel();
    generatedScriptPanel.setBackground(Color.white);
    generatedScriptPanel.setLayout(new CardLayout());
    generatedScriptPanel.add(scriptTextArea, "");

    tabbedPane = new JTabbedPane();
    tabbedPane.addTab("Step", stepPanel);

    tabbedPane.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            switchTab = (lastSelectedIndex == 0 && tabbedPane.getSelectedIndex() == 1) ? true : false;
            updateCodePanel(null);
        }
    });

    for (TransformerStepPlugin transformerStepPlugin : LoadedExtensions.getInstance()
            .getTransformerStepPlugins().values()) {
        transformerStepPlugin.initialize(this);
    }

    // establish the cards to use in the Transformer
    stepPanel.addCard(blankPanel, BLANK_TYPE);
    for (TransformerStepPlugin plugin : LoadedExtensions.getInstance().getTransformerStepPlugins().values()) {
        stepPanel.addCard(plugin.getPanel(), plugin.getPluginPointName());
    }
    transformerTablePane = new JScrollPane();
    transformerTablePane.setBorder(BorderFactory.createEmptyBorder());

    viewTasks = new JXTaskPane();
    viewTasks.setTitle("Mirth Views");
    viewTasks.setFocusable(false);
    viewTasks.add(initActionCallback("accept", "Return back to channel.",
            ActionFactory.createBoundAction("accept", "Back to Channel", "B"),
            new ImageIcon(Frame.class.getResource("images/resultset_previous.png"))));
    parent.setNonFocusable(viewTasks);
    viewTasks.setVisible(false);
    parent.taskPaneContainer.add(viewTasks, parent.taskPaneContainer.getComponentCount() - 1);

    transformerTasks = new JXTaskPane();
    transformerTasks.setTitle("Transformer Tasks");
    transformerTasks.setFocusable(false);

    transformerPopupMenu = new JPopupMenu();

    // add new step task
    transformerTasks.add(initActionCallback("addNewStep", "Add a new transformer step.",
            ActionFactory.createBoundAction("addNewStep", "Add New Step", "N"),
            new ImageIcon(Frame.class.getResource("images/add.png"))));
    JMenuItem addNewStep = new JMenuItem("Add New Step");
    addNewStep.setIcon(new ImageIcon(Frame.class.getResource("images/add.png")));
    addNewStep.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            addNewStep();
        }
    });
    transformerPopupMenu.add(addNewStep);

    // delete step task
    transformerTasks.add(initActionCallback("deleteStep", "Delete the currently selected transformer step.",
            ActionFactory.createBoundAction("deleteStep", "Delete Step", "X"),
            new ImageIcon(Frame.class.getResource("images/delete.png"))));
    JMenuItem deleteStep = new JMenuItem("Delete Step");
    deleteStep.setIcon(new ImageIcon(Frame.class.getResource("images/delete.png")));
    deleteStep.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            deleteStep();
        }
    });
    transformerPopupMenu.add(deleteStep);

    transformerTasks.add(initActionCallback("doImport", "Import a transformer from an XML file.",
            ActionFactory.createBoundAction("doImport", "Import Transformer", "I"),
            new ImageIcon(Frame.class.getResource("images/report_go.png"))));
    JMenuItem importTransformer = new JMenuItem("Import Transformer");
    importTransformer.setIcon(new ImageIcon(Frame.class.getResource("images/report_go.png")));
    importTransformer.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            doImport();
        }
    });
    transformerPopupMenu.add(importTransformer);

    transformerTasks.add(initActionCallback("doExport", "Export the transformer to an XML file.",
            ActionFactory.createBoundAction("doExport", "Export Transformer", "E"),
            new ImageIcon(Frame.class.getResource("images/report_disk.png"))));
    JMenuItem exportTransformer = new JMenuItem("Export Transformer");
    exportTransformer.setIcon(new ImageIcon(Frame.class.getResource("images/report_disk.png")));
    exportTransformer.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            doExport();
        }
    });
    transformerPopupMenu.add(exportTransformer);

    transformerTasks.add(initActionCallback("doValidate", "Validate the currently viewed script.",
            ActionFactory.createBoundAction("doValidate", "Validate Script", "V"),
            new ImageIcon(Frame.class.getResource("images/accept.png"))));
    JMenuItem validateStep = new JMenuItem("Validate Script");
    validateStep.setIcon(new ImageIcon(Frame.class.getResource("images/accept.png")));
    validateStep.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            doValidate();
        }
    });
    transformerPopupMenu.add(validateStep);

    // move step up task
    transformerTasks.add(initActionCallback("moveStepUp", "Move the currently selected step up.",
            ActionFactory.createBoundAction("moveStepUp", "Move Step Up", "P"),
            new ImageIcon(Frame.class.getResource("images/arrow_up.png"))));
    JMenuItem moveStepUp = new JMenuItem("Move Step Up");
    moveStepUp.setIcon(new ImageIcon(Frame.class.getResource("images/arrow_up.png")));
    moveStepUp.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            moveStepUp();
        }
    });
    transformerPopupMenu.add(moveStepUp);

    // move step down task
    transformerTasks.add(initActionCallback("moveStepDown", "Move the currently selected step down.",
            ActionFactory.createBoundAction("moveStepDown", "Move Step Down", "D"),
            new ImageIcon(Frame.class.getResource("images/arrow_down.png"))));
    JMenuItem moveStepDown = new JMenuItem("Move Step Down");
    moveStepDown.setIcon(new ImageIcon(Frame.class.getResource("images/arrow_down.png")));
    moveStepDown.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            moveStepDown();
        }
    });
    transformerPopupMenu.add(moveStepDown);

    // add the tasks to the taskpane, and the taskpane to the mirth client
    parent.setNonFocusable(transformerTasks);
    transformerTasks.setVisible(false);
    parent.taskPaneContainer.add(transformerTasks, parent.taskPaneContainer.getComponentCount() - 1);

    makeTransformerTable();

    // BGN LAYOUT
    transformerTable.setBorder(BorderFactory.createEmptyBorder());
    transformerTablePane.setBorder(BorderFactory.createEmptyBorder());
    transformerTablePane.setMinimumSize(new Dimension(0, 40));
    stepPanel.setBorder(BorderFactory.createEmptyBorder());

    hSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, transformerTablePane, tabbedPane);
    hSplitPane.setContinuousLayout(true);
    // hSplitPane.setDividerSize(6);
    hSplitPane.setOneTouchExpandable(true);
    vSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, hSplitPane, refPanel);
    // vSplitPane.setDividerSize(6);
    vSplitPane.setOneTouchExpandable(true);
    vSplitPane.setContinuousLayout(true);

    hSplitPane.setBorder(BorderFactory.createEmptyBorder());
    vSplitPane.setBorder(BorderFactory.createEmptyBorder());
    this.setLayout(new BorderLayout());
    this.add(vSplitPane, BorderLayout.CENTER);
    setBorder(BorderFactory.createEmptyBorder());
    resizePanes();
    // END LAYOUT

}

From source file:de.hshannover.f4.trust.visitmeta.gui.GraphConnection.java

private JPopupMenu createContextMenu(final GraphicWrapper node) {
    JPopupMenu result = new JPopupMenu();

    for (final ContextMenuItem item : mContextMenuItems) {
        JMenuItem menuItem = new JMenuItem(item.getItemTitle());
        menuItem.addActionListener(new ActionListener() {
            @Override// www .  j a  v  a  2  s .com
            public void actionPerformed(ActionEvent e) {
                item.actionPerformed(node);
            }
        });

        if (!item.canHandle(node.getData())) {
            menuItem.setEnabled(false);
        }

        result.add(menuItem);
    }

    return result;
}