Example usage for javax.swing JMenu add

List of usage examples for javax.swing JMenu add

Introduction

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

Prototype

public JMenuItem add(Action a) 

Source Link

Document

Creates a new menu item attached to the specified Action object and appends it to the end of this menu.

Usage

From source file:adams.gui.tools.FileMonitorPanel.java

/**
 * Creates a menu bar (singleton per panel object). Can be used in frames.
 *
 * @return      the menu bar//from w w  w .  java  2 s  .  c  om
 */
@Override
public JMenuBar getMenuBar() {
    JMenuBar result;
    JMenu menu;
    JMenu submenu;
    JMenuItem menuitem;

    if (m_MenuBar == null) {
        result = new JMenuBar();

        // File
        menu = new JMenu("File");
        result.add(menu);
        menu.setMnemonic('F');
        menu.addChangeListener((ChangeEvent e) -> updateMenu());

        menuitem = new JMenuItem("Open...", GUIHelper.getIcon("open.gif"));
        menuitem.setMnemonic('O');
        menuitem.setAccelerator(GUIHelper.getKeyStroke("ctrl pressed O"));
        menuitem.addActionListener((ActionEvent e) -> open());
        menu.add(menuitem);
        m_MenuItemOpen = menuitem;

        // File/Recent files
        submenu = new JMenu("Open recent");
        menu.add(submenu);
        m_RecentFilesHandler = new RecentFilesHandler<>(SESSION_FILE, 5, submenu);
        m_RecentFilesHandler.addRecentItemListener(new RecentItemListener<JMenu, File>() {
            public void recentItemAdded(RecentItemEvent<JMenu, File> e) {
                // ignored
            }

            public void recentItemSelected(RecentItemEvent<JMenu, File> e) {
                open(e.getItem());
            }
        });
        m_MenuItemOpenRecent = submenu;

        menu.addSeparator();

        menuitem = new JMenuItem("Close", GUIHelper.getIcon("exit.png"));
        menuitem.setMnemonic('C');
        menuitem.setAccelerator(GUIHelper.getKeyStroke("ctrl pressed Q"));
        menuitem.addActionListener((ActionEvent e) -> close());
        menu.add(menuitem);
        m_MenuItemClose = menuitem;

        // update menu
        m_MenuBar = result;
        updateMenu();
    } else {
        result = m_MenuBar;
    }

    return result;
}

From source file:me.philnate.textmanager.windows.MainWindow.java

/**
 * Initialize the contents of the frame.
 *//*  w ww.  ja v a2  s  . c  o m*/
private void initialize() {
    changeListener = new ChangeListener();

    frame = new JFrame();
    frame.addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(WindowEvent e) {
            Starter.shutdown();
        }
    });
    frame.setBounds(100, 100, 1197, 500);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.getContentPane().setLayout(new MigLayout("", "[grow]", "[][grow][::16px]"));

    customers = new CustomerComboBox();
    customers.addItemListener(changeListener);

    frame.getContentPane().add(customers, "flowx,cell 0 0,growx");

    jScrollPane = new JScrollPane();
    billLines = new BillingItemTable(frame, true);

    jScrollPane.setViewportView(billLines);
    frame.getContentPane().add(jScrollPane, "cell 0 1,grow");

    // for each file added through drag&drop create a new lineItem
    new FileDrop(jScrollPane, new FileDrop.Listener() {

        @Override
        public void filesDropped(File[] files) {
            for (File file : files) {
                addNewBillingItem(Document.loadAndSave(file));
            }
        }
    });

    monthChooser = new JMonthChooser();
    monthChooser.addPropertyChangeListener(changeListener);
    frame.getContentPane().add(monthChooser, "cell 0 0");

    yearChooser = new JYearChooser();
    yearChooser.addPropertyChangeListener(changeListener);
    frame.getContentPane().add(yearChooser, "cell 0 0");

    JButton btnAddLine = new JButton();
    btnAddLine.setIcon(ImageRegistry.getImage("load.gif"));
    btnAddLine.setToolTipText(getCaption("mw.tooltip.add"));
    btnAddLine.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            addNewBillingItem();
        }
    });

    frame.getContentPane().add(btnAddLine, "cell 0 0");

    JButton btnMassAdd = new JButton();
    btnMassAdd.setIcon(ImageRegistry.getImage("load_all.gif"));
    btnMassAdd.setToolTipText(getCaption("mw.tooltip.massAdd"));
    btnMassAdd.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent arg0) {
            JFileChooser file = new DocXFileChooser();
            switch (file.showOpenDialog(frame)) {
            case JFileChooser.APPROVE_OPTION:
                File[] files = file.getSelectedFiles();
                if (null != files) {
                    for (File fl : files) {
                        addNewBillingItem(Document.loadAndSave(fl));
                    }
                }
                break;
            default:
                return;
            }
        }
    });

    frame.getContentPane().add(btnMassAdd, "cell 0 0");

    billNo = new JTextField();
    // enable/disable build button based upon text in billNo
    billNo.getDocument().addDocumentListener(new DocumentListener() {

        @Override
        public void removeUpdate(DocumentEvent arg0) {
            setButtonStates();
        }

        @Override
        public void insertUpdate(DocumentEvent arg0) {
            setButtonStates();
        }

        @Override
        public void changedUpdate(DocumentEvent arg0) {
            setButtonStates();
        }

        private void setButtonStates() {
            boolean notBlank = StringUtils.isNotBlank(billNo.getText());
            build.setEnabled(notBlank);
            view.setEnabled(pdf.find(billNo.getText() + ".pdf").size() == 1);
        }
    });
    frame.getContentPane().add(billNo, "cell 0 0");
    billNo.setColumns(10);

    build = new JButton();
    build.setEnabled(false);// disable build Button until there's some
    // billNo entered
    build.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            if (runningThread == null) {
                try {
                    // check that billNo isn't empty or already used within
                    // another Bill
                    if (billNo.getText().trim().equals("")) {
                        JOptionPane.showMessageDialog(frame, getCaption("mw.dialog.error.billNoBlank.msg"),
                                getCaption("mw.dialog.error.billNoBlank.title"), JOptionPane.ERROR_MESSAGE);
                        return;
                    }
                    try {
                        bill.setBillNo(billNo.getText()).save();
                    } catch (DuplicateKey e) {
                        // unset the internal value as this is already used
                        bill.setBillNo("");
                        JOptionPane.showMessageDialog(frame,
                                format(getCaption("mw.error.billNoUsed.msg"), billNo.getText()),
                                getCaption("mw.dialog.error.billNoBlank.title"), JOptionPane.ERROR_MESSAGE);
                        return;
                    }
                    PDFCreator pdf = new PDFCreator(bill);
                    pdf.addListener(new ThreadCompleteListener() {

                        @Override
                        public void threadCompleted(NotifyingThread notifyingThread) {
                            build.setToolTipText(getCaption("mw.tooltip.build"));
                            build.setIcon(ImageRegistry.getImage("build.png"));
                            runningThread = null;
                            view.setEnabled(DB.pdf.find(billNo.getText() + ".pdf").size() == 1);
                        }
                    });
                    runningThread = new Thread(pdf);
                    runningThread.start();
                } catch (Exception e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
                build.setToolTipText(getCaption("mw.tooltip.build.cancel"));
                build.setIcon(ImageRegistry.getImage("cancel.gif"));
            } else {
                runningThread.interrupt();
                runningThread = null;
                build.setToolTipText(getCaption("mw.tooltip.build"));
                build.setIcon(ImageRegistry.getImage("build.png"));

            }
        }
    });
    build.setToolTipText(getCaption("mw.tooltip.build"));
    build.setIcon(ImageRegistry.getImage("build.png"));
    frame.getContentPane().add(build, "cell 0 0");

    view = new JButton();
    view.setToolTipText(getCaption("mw.tooltip.view"));
    view.setIcon(ImageRegistry.getImage("view.gif"));
    view.setEnabled(false);
    view.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            File file = new File(System.getProperty("user.dir"),
                    format("template/%s.tmp.pdf", billNo.getText()));
            try {
                pdf.findOne(billNo.getText() + ".pdf").writeTo(file);
                new ProcessBuilder(Setting.find("pdfViewer").getValue(), file.getAbsolutePath()).start()
                        .waitFor();
                file.delete();
            } catch (IOException | InterruptedException e1) {
                // TODO Auto-generated catch block
                LOG.warn("Error while building PDF", e1);
            }
        }
    });
    frame.getContentPane().add(view, "cell 0 0");

    statusBar = new JPanel();
    statusBar.setBorder(new BevelBorder(BevelBorder.LOWERED));
    statusBar.setLayout(new BoxLayout(statusBar, BoxLayout.X_AXIS));
    GitRepositoryState state = DB.state;
    JLabel statusLabel = new JLabel(String.format("textManager Version v%s build %s",
            state.getCommitIdDescribe(), state.getBuildTime()));
    statusLabel.setHorizontalAlignment(SwingConstants.LEFT);
    statusBar.add(statusLabel);
    frame.add(statusBar, "cell 0 2,growx");

    JMenuBar menuBar = new JMenuBar();
    frame.setJMenuBar(menuBar);

    JMenu menu = new JMenu(getCaption("mw.menu.edit"));
    JMenuItem itemCust = new JMenuItem(getCaption("mw.menu.edit.customer"));
    itemCust.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent arg0) {
            new CustomerWindow(customers);
        }
    });
    menu.add(itemCust);

    JMenuItem itemSetting = new JMenuItem(getCaption("mw.menu.edit.settings"));
    itemSetting.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent arg0) {
            new SettingWindow();
        }
    });
    menu.add(itemSetting);

    JMenuItem itemImport = new JMenuItem(getCaption("mw.menu.edit.import"));
    itemImport.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent arg0) {
            new ImportWindow(new ImportListener() {

                @Override
                public void entriesImported(List<BillingItem> items) {
                    for (BillingItem item : items) {
                        item.setCustomerId(customers.getSelectedCustomer().getId())
                                .setMonth(monthChooser.getMonth()).setYear(yearChooser.getYear());
                        item.save();
                        billLines.addRow(item);
                    }
                }
            }, frame);
        }
    });
    menu.add(itemImport);

    menuBar.add(menu);

    customers.loadCustomer();
    fillTableModel();
}

From source file:com.googlecode.bpmn_simulator.gui.BPMNSimulatorFrame.java

private JMenu createMenuFileExport() {
    final JMenu menuExport = new JMenu("Export as");

    final JMenuItem asImageItem = new JMenuItem("Image");
    asImageItem.addActionListener(new ActionListener() {
        @Override// w  w  w .ja  v  a  2 s  .c  o  m
        public void actionPerformed(final ActionEvent e) {
            exportAsImage();
        }
    });
    menuExport.add(asImageItem);

    return menuExport;
}

From source file:DragPictureDemo2.java

public JMenuBar createMenuBar() {
    JMenuItem menuItem = null;/* w ww.  j  av  a 2s. c  o  m*/
    JMenuBar menuBar = new JMenuBar();
    JMenu mainMenu = new JMenu("Edit");
    mainMenu.setMnemonic(KeyEvent.VK_E);
    TransferActionListener actionListener = new TransferActionListener();

    menuItem = new JMenuItem("Cut");
    menuItem.setActionCommand((String) TransferHandler.getCutAction().getValue(Action.NAME));
    menuItem.addActionListener(actionListener);
    menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, ActionEvent.CTRL_MASK));
    menuItem.setMnemonic(KeyEvent.VK_T);
    mainMenu.add(menuItem);
    menuItem = new JMenuItem("Copy");
    menuItem.setActionCommand((String) TransferHandler.getCopyAction().getValue(Action.NAME));
    menuItem.addActionListener(actionListener);
    menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, ActionEvent.CTRL_MASK));
    menuItem.setMnemonic(KeyEvent.VK_C);
    mainMenu.add(menuItem);
    menuItem = new JMenuItem("Paste");
    menuItem.setActionCommand((String) TransferHandler.getPasteAction().getValue(Action.NAME));
    menuItem.addActionListener(actionListener);
    menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V, ActionEvent.CTRL_MASK));
    menuItem.setMnemonic(KeyEvent.VK_P);
    mainMenu.add(menuItem);

    menuBar.add(mainMenu);
    return menuBar;
}

From source file:com.projity.pm.graphic.gantt.GanttPopupMenu.java

/**
 * Because the styles may change, rebuild the menu each time
 *
 *///  w  w w  . ja  va 2 s  . c  om
protected void init() {
    removeAll();
    add(new SplitModeMenuAction());
    add(new AssignmentsMenuAction());
    final JMenu bars = new JMenu(Messages.getString("Gantt.Popup.barStylesMenu"));
    final JMenu annotations = new JMenu(Messages.getString("Gantt.Popup.annotationStylesMenu"));
    CollectionUtils.forAllDo(interactor.getGraph().getBarStyles().getRows(), new Closure() {
        public void execute(Object arg0) {
            BarStyle barStyle = (BarStyle) arg0;
            BarMenuAction menuAction = new BarMenuAction(barStyle);
            if (barStyle.isLink()) // move the show links item to the main menu
                add(menuAction);
            else if (barStyle.isCalendar()) // move the show links item to the main menu
                add(menuAction);
            else if (barStyle.isHorizontalGrid()) // move the show links item to the main menu
                add(menuAction);
            else if (barStyle.isAnnotation())
                annotations.add(menuAction);
            else
                bars.add(menuAction);

        }
    });
    add(bars);
    add(annotations);

}

From source file:JXButtonPanel.java

public JXButtonPanelDemo() {
    super("JXButtonPanel demo");
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setResizable(false);/*from w  w w  . j a  v  a2 s.c o  m*/
    JPanel topPanel = new JPanel(new GridLayout(1, 0));

    final JXButtonPanel radioGroupPanel = createRadioJXButtonPanel();
    topPanel.add(radioGroupPanel);

    final JXButtonPanel checkBoxPanel = createCheckBoxJXButtonPanel();
    topPanel.add(checkBoxPanel);

    add(topPanel);
    add(createButtonJXButtonPanel(), BorderLayout.SOUTH);
    pack();

    JMenuBar bar = new JMenuBar();
    JMenu menu = new JMenu("Options");
    JMenuItem item = new JMenuItem("Unselect radioButtons");
    item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, InputEvent.ALT_MASK));
    item.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            // hack for 1.5 
            // in 1.6 ButtonGroup.clearSelection added
            JRadioButton b = new JRadioButton();
            radioGroup.add(b);
            b.setSelected(true);
            radioGroup.remove(b);
        }
    });
    menu.add(item);
    bar.add(menu);
    setJMenuBar(bar);

    setSize(300, 300);
    setLocationRelativeTo(null);
}

From source file:net.erdfelt.android.sdkfido.ui.SdkFidoFrame.java

private JMenu createViewMenu() {
    JMenu viewMenu = new JMenu("View");
    viewMenu.setMnemonic('v');

    JMenu lnfMenu = new JMenu("Look and Feel");
    lnfMenu.setMnemonic('f');

    ButtonGroup lnfGroup = new ButtonGroup();
    LookAndFeelInfo lnfs[] = UIManager.getInstalledLookAndFeels();
    String lnfCurrentName = null;
    LookAndFeel lnfCurrent = UIManager.getLookAndFeel();
    if (lnfCurrent != null) {
        lnfCurrentName = lnfCurrent.getClass().getName();
    }/*  w ww  .j  a  va2  s  .  com*/
    UISwitcher switcher = new UISwitcher();
    for (int i = 0; i < lnfs.length; i++) {
        JRadioButtonMenuItem lnfItem = new JRadioButtonMenuItem(lnfs[i].getName());
        lnfItem.addActionListener(switcher);
        lnfItem.setActionCommand(lnfs[i].getClassName());
        lnfGroup.add(lnfItem);
        lnfMenu.add(lnfItem);

        if (lnfs[i].getClassName().equals(lnfCurrentName)) {
            lnfGroup.setSelected(lnfItem.getModel(), true);
        }
    }
    viewMenu.add(lnfMenu);

    return viewMenu;
}

From source file:be.agiv.security.demo.Main.java

private void addMenuBar() {
    JMenuBar menuBar = new JMenuBar();
    setJMenuBar(menuBar);/*www .j a v  a  2  s.c o m*/

    JMenu fileMenu = new JMenu("File");
    menuBar.add(fileMenu);
    this.preferencesMenuItem = new JMenuItem("Preferences");
    fileMenu.add(this.preferencesMenuItem);
    this.preferencesMenuItem.addActionListener(this);
    fileMenu.addSeparator();
    this.exitMenuItem = new JMenuItem("Exit");
    fileMenu.add(this.exitMenuItem);
    this.exitMenuItem.addActionListener(this);

    JMenu ipStsMenu = new JMenu("IP-STS");
    menuBar.add(ipStsMenu);
    this.ipStsIssueMenuItem = new JMenuItem("Issue token");
    ipStsMenu.add(this.ipStsIssueMenuItem);
    this.ipStsIssueMenuItem.addActionListener(this);
    this.ipStsViewMenuItem = new JMenuItem("View token");
    ipStsMenu.add(this.ipStsViewMenuItem);
    this.ipStsViewMenuItem.addActionListener(this);
    this.ipStsViewMenuItem.setEnabled(false);

    JMenu rStsMenu = new JMenu("R-STS");
    menuBar.add(rStsMenu);
    this.rStsIssueMenuItem = new JMenuItem("Issue token");
    rStsMenu.add(this.rStsIssueMenuItem);
    this.rStsIssueMenuItem.addActionListener(this);
    this.rStsIssueMenuItem.setEnabled(false);
    this.rStsViewMenuItem = new JMenuItem("View token");
    rStsMenu.add(this.rStsViewMenuItem);
    this.rStsViewMenuItem.addActionListener(this);
    this.rStsViewMenuItem.setEnabled(false);

    JMenu secConvMenu = new JMenu("Secure Conversation");
    menuBar.add(secConvMenu);
    this.secConvIssueMenuItem = new JMenuItem("Issue token");
    secConvMenu.add(this.secConvIssueMenuItem);
    this.secConvIssueMenuItem.addActionListener(this);
    this.secConvIssueMenuItem.setEnabled(false);
    this.secConvViewMenuItem = new JMenuItem("View token");
    secConvMenu.add(this.secConvViewMenuItem);
    this.secConvViewMenuItem.addActionListener(this);
    this.secConvViewMenuItem.setEnabled(false);
    this.secConvCancelMenuItem = new JMenuItem("Cancel token");
    secConvMenu.add(this.secConvCancelMenuItem);
    this.secConvCancelMenuItem.addActionListener(this);
    this.secConvCancelMenuItem.setEnabled(false);

    JMenu servicesMenu = new JMenu("Services");
    menuBar.add(servicesMenu);
    this.claimsAwareServiceMenuItem = new JMenuItem("Claims aware service");
    servicesMenu.add(this.claimsAwareServiceMenuItem);
    this.claimsAwareServiceMenuItem.addActionListener(this);

    menuBar.add(Box.createHorizontalGlue());
    JMenu helpMenu = new JMenu("Help");
    menuBar.add(helpMenu);
    this.aboutMenuItem = new JMenuItem("About");
    helpMenu.add(this.aboutMenuItem);
    this.aboutMenuItem.addActionListener(this);
}

From source file:de.tud.kom.p2psim.impl.skynet.visualization.SkyNetVisualization.java

public void setAvailableMetrics(Vector<String> names) {
    Vector<String> temp = new Vector<String>();
    temp.addAll(names);/* w ww.  j a v a2  s  .  c  om*/
    temp.add("Online Peers");
    temp.add("Available Attributes");
    temp.add("Memory Usage");
    Collections.sort(temp);

    JMenu met = mb.getMenu(1);
    met.setEnabled(true);
    JMenu avgMet = new JMenu("Average Metrics");
    JMenu genMet = new JMenu("General Metrics");
    JMenu recMet = new JMenu("Metrics for Receiving");
    JMenu sentMet = new JMenu("Metrics for Sending");
    JCheckBoxMenuItem item = null;
    for (String name : temp) {
        if (name.startsWith("Aver")) {
            item = new JCheckBoxMenuItem(name, false);
            item.addActionListener(this);
            avgMet.add(item);
        } else if (name.startsWith("Rec")) {
            item = new JCheckBoxMenuItem(name, false);
            item.addActionListener(this);
            recMet.add(item);
        } else if (name.startsWith("Sent")) {
            item = new JCheckBoxMenuItem(name, false);
            item.addActionListener(this);
            sentMet.add(item);
        } else {
            item = new JCheckBoxMenuItem(name, false);
            item.addActionListener(this);
            genMet.add(item);
        }
    }
    avgMet.add(new JSeparator(SwingConstants.HORIZONTAL));
    avgMet.add(createMenuItem("Display all Average Metrics"));
    avgMet.add(createMenuItem("Remove all Average Metrics"));

    genMet.add(new JSeparator(SwingConstants.HORIZONTAL));
    genMet.add(createMenuItem("Display all General Metrics"));
    genMet.add(createMenuItem("Remove all General Metrics"));

    recMet.add(new JSeparator(SwingConstants.HORIZONTAL));
    recMet.add(createMenuItem("Display all Metrics for Receiving"));
    recMet.add(createMenuItem("Remove all Metrics for Receiving"));

    sentMet.add(new JSeparator(SwingConstants.HORIZONTAL));
    sentMet.add(createMenuItem("Display all Metrics for Sending"));
    sentMet.add(createMenuItem("Remove all Metrics for Sending"));

    met.add(avgMet);
    met.add(genMet);
    met.add(recMet);
    met.add(sentMet);

    met.add(new JSeparator(SwingConstants.HORIZONTAL));
    met.add(createMenuItem("Display all Metrics"));
    met.add(createMenuItem("Remove all Metrics"));

    mb.add(met);
    repaint();
    log.warn("Created Menu 'Available Metrics'");
}

From source file:mendeley2kindle.MainUIFrame.java

public MainUIFrame(Properties config, Mendeley2Kindle core) {
    super("Mendeley2Kindle");
    setDefaultCloseOperation(EXIT_ON_CLOSE);

    this.core = core;
    core.addStateListener(new UISyncStateListener());

    components = new ArrayList<JComponent>();

    JMenuBar menuBar = new JMenuBar();
    JMenu fileMenu = new JMenu("File");
    JMenuItem openMenuItem = new JMenuItem("Open Mendeley database");
    openMenuItem.addActionListener(new OpenMendeleyListener());
    JMenuItem selectKindleMenuItem = new JMenuItem("Select Kindle device path");
    selectKindleMenuItem.addActionListener(new SelectKindleListener());
    JMenuItem exitMenuItem = new JMenuItem("Quit");
    exitMenuItem.addActionListener(new QuitListener());
    fileMenu.add(openMenuItem);
    fileMenu.add(selectKindleMenuItem);/*  w  w w.  j  av  a 2 s. co  m*/
    fileMenu.add(exitMenuItem);
    menuBar.add(fileMenu);

    JMenu helpMenu = new JMenu("Help");
    JMenuItem aboutMenuItem = new JMenuItem("About");
    aboutMenuItem.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            String text = "Mendeley2Kindle 0.3.2\n"
                    + " (c) Copyright Yukinari Toyota, 2013. All rights reserved.\n"
                    + " Contact: Yukinari Toyota <xxseyxx@gmail.com>\n"
                    + " Site: http://sites.google.com/site/xxseyxx/\n" + "Some Icons by Yusuke Kamiyamane\n"
                    + " Site: http://p.yusukekamiyamane.com/\n"
                    + "sqlite-jdbc-3.7.2.jar is provided by xerial.org\n"
                    + " under Apache License version 2.0 (http://www.apache.org/licenses/ )\n"
                    + " Site: https://bitbucket.org/xerial/sqlite-jdbc\n";
            JOptionPane.showMessageDialog(MainUIFrame.this, text);
        }
    });
    helpMenu.add(aboutMenuItem);
    menuBar.add(helpMenu);

    setJMenuBar(menuBar);

    getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.Y_AXIS));

    getContentPane().add(new JLabel("Select Mendeley collections"));

    collectionsJList = new JList();
    DragSelectionListener mil = new DragSelectionListener();
    collectionsJList.addMouseMotionListener(mil);
    collectionsJList.addMouseListener(mil);
    collectionsJList.setCellRenderer(new MyCellRenderer());
    // collectionsJList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);

    JScrollPane scroll = new JScrollPane();
    scroll.setPreferredSize(new Dimension(200, 300));
    scroll.getViewport().setView(collectionsJList);
    getContentPane().add(scroll);

    mainButton = new JButton("Open Mendeley database");
    mainButton.addActionListener(new OpenMendeleyListener());
    getContentPane().add(mainButton);

    components.add(collectionsJList);

    for (JComponent c : components)
        c.setEnabled(false);

    pack();
}