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:org.biojava.bio.view.MotifAnalyzer.java

/**
 * This method initializes jJMenuBar   //from ww  w.  j  a  v a2  s  . c  om
 *    
 * @return javax.swing.JMenuBar   
 */
private JMenuBar getJJMenuBar() {
    if (jJMenuBar == null) {
        jJMenuBar = new JMenuBar();
        jJMenuBar.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
    }
    /* File Menu */
    JMenu fileMenu = new JMenu("File");
    fileMenu.setFont(menuFont);
    jJMenuBar.add(fileMenu);

    JMenuItem loadItem = new JMenuItem(loadMenuName);
    loadItem.addActionListener(this);
    fileMenu.add(loadItem);

    JMenuItem saveItem = new JMenuItem(saveMenuName);
    saveItem.addActionListener(this);
    fileMenu.add(saveItem);

    JMenuItem openMotifVoterItem = new JMenuItem(convertMotifVoterMenuName);
    openMotifVoterItem.addActionListener(this);
    fileMenu.add(openMotifVoterItem);

    JMenuItem runPatchConverMVItem = new JMenuItem(runPatchConverMVMenuName);
    runPatchConverMVItem.addActionListener(this);
    fileMenu.add(runPatchConverMVItem);

    JMenuItem convertAllItem = new JMenuItem(convertAllMenuName);
    convertAllItem.addActionListener(this);
    fileMenu.add(convertAllItem);

    JMenuItem runPatchConverAllItem = new JMenuItem(runPatchConverAllMenuName);
    runPatchConverAllItem.addActionListener(this);
    fileMenu.add(runPatchConverAllItem);

    JMenuItem compareSetsItem = new JMenuItem(compareSetsName);
    compareSetsItem.addActionListener(this);
    fileMenu.add(compareSetsItem);

    JMenuItem mergeCompareSetsItem = new JMenuItem(mergeCompareSetsName);
    mergeCompareSetsItem.addActionListener(this);
    fileMenu.add(mergeCompareSetsItem);

    JMenuItem copyFilesWithExtensionItem = new JMenuItem(copyCleanInputFilesName);
    copyFilesWithExtensionItem.addActionListener(this);
    fileMenu.add(copyFilesWithExtensionItem);

    JMenuItem exitItem = new JMenuItem("Exit");
    exitItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent actionEvent) {
            System.exit(0);
        }
    });
    fileMenu.add(exitItem);

    /* Tools Menu */
    JMenu toolsMenu = new JMenu("Tools");
    toolsMenu.setFont(menuFont);
    jJMenuBar.add(toolsMenu);

    JMenuItem gibbsItem = new JMenuItem(gibbsMenuName);
    gibbsItem.addActionListener(this);
    toolsMenu.add(gibbsItem);

    JMenuItem infoContentItem = new JMenuItem(infoContentMenuName);
    infoContentItem.addActionListener(this);
    toolsMenu.add(infoContentItem);

    JMenuItem removeRedundantSitesItem = new JMenuItem(removeRedundantSitesName);
    removeRedundantSitesItem.addActionListener(this);
    toolsMenu.add(removeRedundantSitesItem);

    JMenuItem extractSitesItem = new JMenuItem(extractSitesName);
    extractSitesItem.addActionListener(this);
    toolsMenu.add(extractSitesItem);

    JMenuItem drawKDistanceGraphItem = new JMenuItem(drawKDistanceGraphName);
    drawKDistanceGraphItem.addActionListener(this);
    toolsMenu.add(drawKDistanceGraphItem);

    JMenuItem computeWeightItem = new JMenuItem(computeWeightName);
    computeWeightItem.addActionListener(this);
    toolsMenu.add(computeWeightItem);

    /* Run Methods Menu */
    JMenu methodMenu = new JMenu("Run Method");
    methodMenu.setFont(menuFont);
    jJMenuBar.add(methodMenu);

    /*
    JMenuItem bioProspectorItem = new JMenuItem(runBioProspectorName);
    bioProspectorItem.addActionListener(this);
    methodMenu.add(bioProspectorItem);
            
    JMenuItem KMeansItem = new JMenuItem(runKMeansName);
    KMeansItem.addActionListener(this);
    methodMenu.add(KMeansItem);
            
    JMenuItem DBScanItem = new JMenuItem(runDBScanName);
    DBScanItem.addActionListener(this);
    methodMenu.add(DBScanItem);
            
    JMenuItem OPTICSItem = new JMenuItem(runOPTICSName);
    OPTICSItem.addActionListener(this);
    methodMenu.add(OPTICSItem);
            
    JMenuItem motifVoteItem = new JMenuItem(runMotifVoterName);
    motifVoteItem.addActionListener(this);
    methodMenu.add(motifVoteItem);
            
    JMenuItem runCliqueItem = new JMenuItem(runCliqueName);
    runCliqueItem.addActionListener(this);
    methodMenu.add(runCliqueItem);
    */

    for (int i = 0; i < Method.values().length; i++) {
        JMenuItem item = new JMenuItem(Method.values()[i].name());
        item.addActionListener(this);
        methodMenu.add(item);
    }

    /* Run Analysis for Methods Menu */
    JMenu analysisMenu = new JMenu("Analysis");
    analysisMenu.setFont(menuFont);
    jJMenuBar.add(analysisMenu);

    JMenuItem evaluateTompaMotifEachItem = new JMenuItem(evaluateTompaMotifEachName);
    evaluateTompaMotifEachItem.addActionListener(this);
    analysisMenu.add(evaluateTompaMotifEachItem);

    JMenuItem evaluateTompaMotifItem = new JMenuItem(evaluateTompaMotifAccName);
    evaluateTompaMotifItem.addActionListener(this);
    analysisMenu.add(evaluateTompaMotifItem);

    JMenuItem evaluateTompaMotifTotalItem = new JMenuItem(evaluateTompaMotifTotalName);
    evaluateTompaMotifTotalItem.addActionListener(this);
    analysisMenu.add(evaluateTompaMotifTotalItem);

    JMenuItem evaluateMotifVoterItem = new JMenuItem(evaluateMotifVoterName);
    evaluateMotifVoterItem.addActionListener(this);
    analysisMenu.add(evaluateMotifVoterItem);

    JMenuItem evaluateMotifVoterTotalItem = new JMenuItem(evaluateMotifVoterTotalName);
    evaluateMotifVoterTotalItem.addActionListener(this);
    analysisMenu.add(evaluateMotifVoterTotalItem);

    JMenuItem evaluateMVDirFirstEleItem = new JMenuItem(evaluateMVDirFirstEleName);
    evaluateMVDirFirstEleItem.addActionListener(this);
    analysisMenu.add(evaluateMVDirFirstEleItem);

    JMenuItem evaluateMVDirMergedItem = new JMenuItem(evaluateMVDirMergedName);
    evaluateMVDirMergedItem.addActionListener(this);
    analysisMenu.add(evaluateMVDirMergedItem);

    JMenuItem compareMotifVoterFirstItem = new JMenuItem(compareMotifVoterFirstName);
    compareMotifVoterFirstItem.addActionListener(this);
    analysisMenu.add(compareMotifVoterFirstItem);

    JMenuItem compareMotifVoterAllItem = new JMenuItem(compareMotifVoterAllName);
    compareMotifVoterAllItem.addActionListener(this);
    analysisMenu.add(compareMotifVoterAllItem);

    JMenuItem EvaluateAllResultsItem = new JMenuItem(evaluateAllResultsName);
    EvaluateAllResultsItem.addActionListener(this);
    analysisMenu.add(EvaluateAllResultsItem);

    return jJMenuBar;
}

From source file:com.pingtel.sipviewer.SIPViewerFrame.java

protected void initMenu() {
    JMenu menu;
    JMenu submenu;/*from  w  w w. ja  v  a  2s.c o  m*/
    JMenuItem menuItem;
    JRadioButtonMenuItem rbMenuItem;

    // Create the menu bar.
    JMenuBar menuBar = new JMenuBar();
    this.setJMenuBar(menuBar);

    // Build the File menu.
    menu = new JMenu("File");
    menu.setMnemonic(KeyEvent.VK_F);
    menuBar.add(menu);

    // Add the load-file items to the File menu.
    menuItem = new JMenuItem();
    menuItem.setAction(new icOpenFileAction());
    menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F, ActionEvent.ALT_MASK));
    menuItem.setMnemonic(KeyEvent.VK_F);
    menu.add(menuItem);

    menuItem = new JMenuItem();
    menuItem.setAction(new icImportSyslogAction());
    menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Y, ActionEvent.ALT_MASK));
    menuItem.setMnemonic(KeyEvent.VK_Y);
    menu.add(menuItem);

    menu.addSeparator();

    menuItem = new JMenuItem();
    menuItem.setAction(new icSaveAsAction());
    menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, ActionEvent.ALT_MASK));
    menuItem.setMnemonic(KeyEvent.VK_S);
    menu.add(menuItem);

    menu.addSeparator();

    // Add the reload item to the File menu.
    menuItem = new JMenuItem();
    menuItem.setAction(new icReloadAction());
    menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_R, ActionEvent.ALT_MASK));
    menuItem.setMnemonic(KeyEvent.VK_R);
    menu.add(menuItem);

    menu.addSeparator();

    // Add the quit item to the File menu.
    menuItem = new JMenuItem();
    menuItem.setAction(new icQuitAction());
    menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q, ActionEvent.ALT_MASK));
    menuItem.setMnemonic(KeyEvent.VK_Q);
    menu.add(menuItem);

    // Build the Options menu.
    menu = new JMenu("Options");
    menu.setMnemonic(KeyEvent.VK_O);
    menuBar.add(menu);

    // Add the split/single screen mode to the options menu
    menuItem = new JMenuItem();
    menuItem.setAction(new icScreenModeAction());
    menuItem.setMnemonic(KeyEvent.VK_M);
    menu.add(menuItem);

    menu.addSeparator();

    // Add the show all dialogs option to the options menu
    menuItem = new JMenuItem();
    menuItem.setAction(new icShowAllDialogsAction());
    menuItem.setMnemonic(KeyEvent.VK_D);
    menu.add(menuItem);

    menu.addSeparator();

    // Add the Time Zone Selection Time submenu
    submenu = new JMenu("Time Zone Setting");
    submenu.setMnemonic(KeyEvent.VK_Z);

    ButtonGroup timeZoneGroup = new ButtonGroup();

    // Set Time Zone to Local Time Zone
    m_localTimeZone = new JRadioButtonMenuItem();
    m_localTimeZone.setAction(new icSetTimeToLocalZone());
    m_localTimeZone.setMnemonic(KeyEvent.VK_L);
    timeZoneGroup.add(m_localTimeZone);
    m_localTimeZone.setSelected(true);
    submenu.add(m_localTimeZone);

    // Set Time Zone to UTC Time Zone
    m_utcTimeZone = new JRadioButtonMenuItem();
    m_utcTimeZone.setAction(new icSetTimeToUTCZone());
    m_utcTimeZone.setMnemonic(KeyEvent.VK_U);
    timeZoneGroup.add(m_utcTimeZone);
    submenu.add(m_utcTimeZone);

    menu.add(submenu);

    // Add the show/hide time index column
    menuItem = new JMenuItem();
    menuItem.setAction(new icTimeVisibilityAction());
    menuItem.setMnemonic(KeyEvent.VK_V);
    menu.add(menuItem);

    // Add the Time Display Format submenu
    submenu = new JMenu("Time Display Format");
    submenu.setMnemonic(KeyEvent.VK_T);

    ButtonGroup group = new ButtonGroup();
    m_dateAndTimeFormat = new JRadioButtonMenuItem();
    m_dateAndTimeFormat.setAction(new icDateAndTimeAction());
    m_dateAndTimeFormat.setMnemonic(KeyEvent.VK_I);
    group.add(m_dateAndTimeFormat);
    submenu.add(m_dateAndTimeFormat);

    m_defaultTimeFormat = new JRadioButtonMenuItem();
    m_defaultTimeFormat.setAction(new icTimeOfDay());
    m_defaultTimeFormat.setMnemonic(KeyEvent.VK_E);
    m_defaultTimeFormat.setSelected(true);
    group.add(m_defaultTimeFormat);
    submenu.add(m_defaultTimeFormat);

    m_sincePreviousFormat = new JRadioButtonMenuItem();
    m_sincePreviousFormat.setAction(new icSincePrevious());
    m_sincePreviousFormat.setMnemonic(KeyEvent.VK_P);
    group.add(m_sincePreviousFormat);
    submenu.add(m_sincePreviousFormat);

    m_sinceBeginningFormat = new JRadioButtonMenuItem();
    m_sinceBeginningFormat.setAction(new icSinceBeginning());
    m_sinceBeginningFormat.setMnemonic(KeyEvent.VK_B);
    group.add(m_sinceBeginningFormat);
    submenu.add(m_sinceBeginningFormat);

    m_sinceKeyIndexFormat = new JRadioButtonMenuItem();
    m_sinceKeyIndexFormat.setAction(new icSinceKeyIndex());
    m_sinceKeyIndexFormat.setMnemonic(KeyEvent.VK_K);
    group.add(m_sinceKeyIndexFormat);
    submenu.add(m_sinceKeyIndexFormat);

    menu.add(submenu);

    // Build the Help menu.
    menu = new JMenu("Help");
    menu.setMnemonic(KeyEvent.VK_H);
    menuBar.add(menu);

    // Add the items to the File menu.
    menuItem = new JMenuItem();
    menuItem.setAction(new icAboutAction());
    menu.add(menuItem);
}

From source file:au.org.ala.delta.editor.DeltaEditor.java

private void buildFileMenu(JMenu mnuFile) {

    mnuFile.removeAll();//  w  w w  .ja v  a2 s  .co  m

    String[] fileMenuActions = { "newFile", "loadFile", "closeFile", "-", "saveFile", "saveAsFile", "-",
            "importDirectives", "exportDirectives" };

    MenuBuilder.buildMenu(mnuFile, fileMenuActions, _actionMap);

    mnuFile.addSeparator();
    String[] previous = EditorPreferences.getPreviouslyUsedFiles();
    if (previous != null && previous.length > 0) {
        javax.swing.Action a = this._actionMap.get("loadPreviousFile");
        if (a != null) {
            for (int i = 0; i < previous.length; ++i) {
                String filename = previous[i];
                JMenuItem item = new JMenuItem();
                item.setAction(a);
                item.setText(String.format("%d %s", i + 1, filename));
                item.putClientProperty("Filename", filename);
                item.setMnemonic(KeyEvent.VK_1 + i);
                mnuFile.add(item);
            }
        }
    }

    if (!isMac()) {
        mnuFile.addSeparator();
        JMenuItem mnuItFileExit = new JMenuItem();
        mnuItFileExit.setAction(_actionMap.get("exitApplication"));
        mnuFile.add(mnuItFileExit);
    }

}

From source file:net.sourceforge.entrainer.gui.EntrainerFX.java

private JMenu getLookAndFeels() {
    JMenu menu = new JMenu("Look and Feel");
    addMnemonic(menu, KeyEvent.VK_K);
    LookAndFeelInfo[] infos = UIManager.getInstalledLookAndFeels();
    Map<String, List<LookAndFeelInfo>> sortedInfos = sortInfos(infos);
    for (String key : sortedInfos.keySet()) {
        List<LookAndFeelInfo> sorted = sortedInfos.get(key);
        JMenu lafMenu = new JMenu(key);
        for (LookAndFeelInfo info : sorted) {
            JMenuItem item = addLookAndFeel(info);
            lafMenu.add(item);
        }/*from ww w.  j a  v a2  s.c om*/
        if (!sorted.isEmpty()) {
            menu.add(lafMenu);
        }
    }

    return menu;
}

From source file:de.whiledo.iliasdownloader2.swing.service.MainController.java

private JMenuBar initMenuBar() {
    JMenuBar menubar = new JMenuBar();
    {//from ww w. j av a 2 s  . com
        JMenu menu = new JMenu("Synchronisation");
        {
            JMenuItem m = new JMenuItem("Kurse auswhlen");
            m.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    chooseCourses();
                }
            });
            menu.add(m);
        }
        {
            JMenuItem m = new JMenuItem("Automatische Synchronisation");
            m.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    showAutoSyncSettings();
                }
            });
            menu.add(m);
        }
        {
            JMenuItem m = new JMenuItem("Neue Dateien zeigen");
            m.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    showNewFiles();
                }
            });
            menu.add(m);
        }
        menubar.add(menu);
    }
    {
        JMenu menu = new JMenu("Einstellungen");
        {
            JMenuItem m = new JMenuItem("Speicherpfad ndern");
            m.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    changeBaseDir();
                }
            });
            menu.add(m);
        }
        {
            JMenuItem m = new JMenuItem("Speicherpfad ffnen");
            m.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    openBaseDir();
                }
            });
            menu.add(m);
        }
        {
            JMenuItem m = new JMenuItem("Maximale Dateigre ndern");
            m.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    changeMaxFileSize();
                }
            });
            menu.add(m);
        }
        {
            final JCheckBoxMenuItem menuitem = new JCheckBoxMenuItem(
                    "Benachrichtigungen im Systemtray anzeigen");
            menuitem.setSelected(iliasProperties.isShowNotifications());
            menuitem.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    iliasProperties.setShowNotifications(!iliasProperties.isShowNotifications());
                    saveProperties(iliasProperties);
                    menuitem.setSelected(iliasProperties.isShowNotifications());
                }
            });
            menu.add(menuitem);
        }
        {
            menu.add(new JSeparator());
        }
        {
            JMenuItem m = new JMenuItem("Design ndern");
            m.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    changeLookAndFeel();
                }
            });
            menu.add(m);
        }
        {
            menu.add(new JSeparator());
        }
        {
            JMenuItem m = new JMenuItem("Server einstellen");
            m.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    chooseServer();
                }
            });
            menu.add(m);
        }
        menubar.add(menu);
    }
    {
        JMenu menu = new JMenu("Hilfe");
        {
            JMenuItem m = new JMenuItem("Fehler melden, Feedback geben");
            m.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    openFeedbackPage();
                }
            });
            menu.add(m);
        }
        {
            JMenuItem m = new JMenuItem("Webseite");
            m.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    openWebsite();
                }
            });
            menu.add(m);
        }
        {
            JMenuItem m = new JMenuItem("Android App");
            m.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    openAndroidWebsite();
                }
            });
            menu.add(m);
        }
        {
            JMenuItem m = new JMenuItem("Info");
            m.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    showInfo();
                }
            });
            menu.add(m);
        }
        menubar.add(menu);
    }
    return menubar;
}

From source file:CheckBoxMenuItemExample.java

public CheckBoxMenuItemExample() {
    menuBar = new JMenuBar();
    JMenu justifyMenu = new JMenu("Justify");
    ActionListener actionPrinter = new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            try {
                pane.getStyledDocument().insertString(0, "Action [" + e.getActionCommand() + "] performed!\n",
                        null);/*from  www . j  a  va2 s  .  c om*/
            } catch (Exception ex) {
                ex.printStackTrace();
            }
        }
    };
    JCheckBoxMenuItem leftJustify = new JCheckBoxMenuItem("Left", new ImageIcon("1.gif"));
    leftJustify.setHorizontalTextPosition(JMenuItem.RIGHT);
    leftJustify
            .setAccelerator(KeyStroke.getKeyStroke('L', Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    leftJustify.addActionListener(actionPrinter);
    JCheckBoxMenuItem rightJustify = new JCheckBoxMenuItem("Right", new ImageIcon("2.gif"));
    rightJustify.setHorizontalTextPosition(JMenuItem.RIGHT);
    rightJustify
            .setAccelerator(KeyStroke.getKeyStroke('R', Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    rightJustify.addActionListener(actionPrinter);
    JCheckBoxMenuItem centerJustify = new JCheckBoxMenuItem("Center", new ImageIcon("3.gif"));
    centerJustify.setHorizontalTextPosition(JMenuItem.RIGHT);
    centerJustify
            .setAccelerator(KeyStroke.getKeyStroke('M', Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    centerJustify.addActionListener(actionPrinter);
    JCheckBoxMenuItem fullJustify = new JCheckBoxMenuItem("Full", new ImageIcon("4.gif"));
    fullJustify.setHorizontalTextPosition(JMenuItem.RIGHT);
    fullJustify
            .setAccelerator(KeyStroke.getKeyStroke('F', Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    fullJustify.addActionListener(actionPrinter);

    justifyMenu.add(leftJustify);
    justifyMenu.add(rightJustify);
    justifyMenu.add(centerJustify);
    justifyMenu.add(fullJustify);

    menuBar.add(justifyMenu);
    menuBar.setBorder(new BevelBorder(BevelBorder.RAISED));

}

From source file:net.sourceforge.entrainer.gui.EntrainerFX.java

private void addEspDevice(JMenu menu, RawEspConnection connection, ButtonGroup bg) {
    JRadioButtonMenuItem item = new JRadioButtonMenuItem(connection.getName());

    bg.add(item);//w w  w.  j  a  v a 2s .c  om
    menu.add(item);

    item.addActionListener(e -> setConnection(connection));
}

From source file:com.adobe.aem.demo.gui.AemDemo.java

@SuppressWarnings({ "rawtypes", "unchecked" })
private void initialize() {

    // Initialize properties
    setDefaultProperties(AemDemoUtils// w  w w  . j  a va  2 s.  c  om
            .loadProperties(buildFile.getParentFile().getAbsolutePath() + File.separator + "build.properties"));
    setPersonalProperties(AemDemoUtils.loadProperties(buildFile.getParentFile().getAbsolutePath()
            + File.separator + "conf" + File.separator + "build-personal.properties"));

    // Constructing the main frame
    frameMain = new JFrame();
    frameMain.setBounds(100, 100, 700, 530);
    frameMain.getContentPane().setLayout(null);

    // Main menu bar for the Frame
    JMenuBar menuBar = new JMenuBar();

    JMenu mnAbout = new JMenu("AEM Demo Machine");
    mnAbout.setMnemonic(KeyEvent.VK_A);
    menuBar.add(mnAbout);

    JMenuItem mntmDoc = new JMenuItem("Help and Documentation");
    mntmDoc.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_H, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    mntmDoc.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.openWebpage(AemDemoUtils.getActualPropertyValue(defaultProperties, personalProperties,
                    AemDemoConstants.OPTIONS_DOCUMENTATION));
        }
    });
    mnAbout.add(mntmDoc);

    JMenuItem mntmQuit = new JMenuItem("Quit");
    mntmQuit.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_Q, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    mntmQuit.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            System.exit(-1);
        }
    });
    mnAbout.add(mntmQuit);

    JMenu mnNew = new JMenu("New");
    mnNew.setMnemonic(KeyEvent.VK_N);
    menuBar.add(mnNew);

    // New Demo Machine
    JMenuItem mntmNewDemo = new JMenuItem("Demo Environment");
    mntmNewDemo.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_N, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    mntmNewDemo.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {

            if (AemDemo.this.getBuildInProgress()) {

                JOptionPane.showMessageDialog(null,
                        "A Demo Environment is currently being built. Please wait until it is finished.");

            } else {

                final AemDemoNew dialogNew = new AemDemoNew(AemDemo.this);
                dialogNew.setModal(true);
                dialogNew.setVisible(true);
                dialogNew.getDemoBuildName().requestFocus();
                ;

            }
        }
    });
    mnNew.add(mntmNewDemo);

    JMenuItem mntmNewOptions = new JMenuItem("Demo Properties");
    mntmNewOptions.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_P, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    mntmNewOptions.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {

            final AemDemoOptions dialogOptions = new AemDemoOptions(AemDemo.this);
            dialogOptions.setModal(true);
            dialogOptions.setVisible(true);

        }
    });
    mnNew.add(mntmNewOptions);

    JMenu mnUpdate = new JMenu("Add-ons");
    menuBar.add(mnUpdate);

    // Sites Add-on
    JMenu mnSites = new JMenu("Sites");
    mnUpdate.add(mnSites);

    JMenuItem mntmSitesDownloadAddOn = new JMenuItem("Download Add-On");
    mntmSitesDownloadAddOn.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "download_sites");
        }
    });
    mnSites.add(mntmSitesDownloadAddOn);

    JMenuItem mntmSitesDownloadFP = new JMenuItem("Download Feature Pack (VPN)");
    mntmSitesDownloadFP.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "download_sites_fp");
        }
    });
    mnSites.add(mntmSitesDownloadFP);

    mnSites.addSeparator();

    JMenuItem mntmSitesInstallAddOn = new JMenuItem("Install Add-on");
    mntmSitesInstallAddOn.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "sites");
        }
    });
    mnSites.add(mntmSitesInstallAddOn);

    // Assets Add-on
    JMenu mnAssets = new JMenu("Assets");
    mnUpdate.add(mnAssets);

    JMenuItem mntmAssetsDownloadAddOn = new JMenuItem("Download Add-on");
    mntmAssetsDownloadAddOn.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "download_assets");
        }
    });
    mnAssets.add(mntmAssetsDownloadAddOn);
    mnAssets.addSeparator();

    JMenuItem mntmAssetsInstallAddOn = new JMenuItem("Install Add-on");
    mntmAssetsInstallAddOn.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "assets");
        }
    });
    mnAssets.add(mntmAssetsInstallAddOn);

    // Communities Add-on
    JMenu mnCommunities = new JMenu("Communities");
    mnUpdate.add(mnCommunities);

    JMenuItem mntmAemCommunitiesUber = new JMenuItem("Download Latest Bundles (VPN)");
    mntmAemCommunitiesUber.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_U, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    mntmAemCommunitiesUber.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "download_communities_bundles");
        }
    });
    mnCommunities.add(mntmAemCommunitiesUber);

    JMenuItem mntmAemCommunitiesFeaturePacks = new JMenuItem("Download Latest Feature Packs (PackageShare)");
    mntmAemCommunitiesFeaturePacks.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "download_communities_fp");
        }
    });
    mnCommunities.add(mntmAemCommunitiesFeaturePacks);

    JMenuItem mntmAemCommunitiesEnablement = new JMenuItem("Download Enablement Demo Site Add-on (4.5GB)");
    mntmAemCommunitiesEnablement.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "download_enablement");
        }
    });
    mnCommunities.add(mntmAemCommunitiesEnablement);
    mnCommunities.addSeparator();

    JMenuItem mntmAemCommunitiesAddOn = new JMenuItem("Install Add-on");
    mntmAemCommunitiesAddOn.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "communities");
        }
    });
    mnCommunities.add(mntmAemCommunitiesAddOn);

    // Forms Add-on
    JMenu mnForms = new JMenu("Forms");
    mnUpdate.add(mnForms);

    JMenuItem mntmAemFormsFP = new JMenuItem("Download Demo Add-on (PackageShare)");
    mntmAemFormsFP.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "download_forms_fp");
        }
    });
    mnForms.add(mntmAemFormsFP);

    mnForms.addSeparator();

    JMenuItem mntmAemFormsAddOn = new JMenuItem("Install Add-on");
    mntmAemFormsAddOn.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "forms");
        }
    });
    mnForms.add(mntmAemFormsAddOn);

    // Apps Add-on
    JMenu mnApps = new JMenu("Apps");
    mnUpdate.add(mnApps);

    JMenuItem mntmAemApps = new JMenuItem("Download Add-on");
    mntmAemApps.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "download_apps");
        }
    });
    mnApps.add(mntmAemApps);

    mnApps.addSeparator();

    JMenuItem mntmAemAppsAddOn = new JMenuItem("Install Add-on");
    mntmAemAppsAddOn.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "apps");
        }
    });
    mnApps.add(mntmAemAppsAddOn);

    // Commerce Add-on
    JMenu mnCommerce = new JMenu("Commerce");
    mnUpdate.add(mnCommerce);

    JMenu mnCommerceDownload = new JMenu("Download Add-on");
    mnCommerce.add(mnCommerceDownload);

    // Commerce EP
    JMenuItem mnCommerceDownloadEP = new JMenuItem("ElasticPath");
    mnCommerceDownloadEP.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "download_commerce_ep");
        }
    });
    mnCommerceDownload.add(mnCommerceDownloadEP);

    // Commerce WebSphere
    JMenuItem mnCommerceDownloadWAS = new JMenuItem("WebSphere");
    mnCommerceDownloadWAS.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "download_commerce_websphere");
        }
    });
    mnCommerceDownload.add(mnCommerceDownloadWAS);

    mnCommerce.addSeparator();

    JMenuItem mntmAemCommerceAddOn = new JMenuItem("Install Add-on");
    mntmAemCommerceAddOn.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "commerce");
        }
    });
    mnCommerce.add(mntmAemCommerceAddOn);

    mnUpdate.addSeparator();

    JMenuItem mntmAemDownloadAll = new JMenuItem("Download All Add-ons");
    mntmAemDownloadAll.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "download_all");
        }
    });
    mnUpdate.add(mntmAemDownloadAll);

    JMenuItem mntmAemDownloadFromDrive = new JMenuItem("Download Web Page");
    mntmAemDownloadFromDrive.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {

            AemDemoUtils.openWebpage(AemDemoUtils.getActualPropertyValue(defaultProperties, personalProperties,
                    AemDemoConstants.OPTIONS_WEBDOWNLOAD));

        }
    });
    mnUpdate.add(mntmAemDownloadFromDrive);

    JMenu mnInfrastructure = new JMenu("Infrastructure");
    menuBar.add(mnInfrastructure);

    JMenu mnMongo = new JMenu("MongoDB");

    JMenuItem mntmInfraMongoDB = new JMenuItem("Download");
    mntmInfraMongoDB.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "download_mongo");
        }
    });
    mnMongo.add(mntmInfraMongoDB);

    JMenuItem mntmInfraMongoDBInstall = new JMenuItem("Install");
    mntmInfraMongoDBInstall.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "install_mongo");
        }
    });
    mnMongo.add(mntmInfraMongoDBInstall);
    mnMongo.addSeparator();

    JMenuItem mntmInfraMongoDBStart = new JMenuItem("Start");
    mntmInfraMongoDBStart.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "mongo_start");
        }
    });
    mnMongo.add(mntmInfraMongoDBStart);

    JMenuItem mntmInfraMongoDBStop = new JMenuItem("Stop");
    mntmInfraMongoDBStop.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "mongo_stop");
        }
    });
    mnMongo.add(mntmInfraMongoDBStop);
    mnInfrastructure.add(mnMongo);

    // SOLR options
    JMenu mnSOLR = new JMenu("SOLR");

    JMenuItem mntmInfraSOLR = new JMenuItem("Download");
    mntmInfraSOLR.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "download_solr");
        }
    });
    mnSOLR.add(mntmInfraSOLR);

    JMenuItem mntmInfraSOLRInstall = new JMenuItem("Install");
    mntmInfraSOLRInstall.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "install_solr");
        }
    });
    mnSOLR.add(mntmInfraSOLRInstall);
    mnSOLR.addSeparator();

    JMenuItem mntmInfraSOLRStart = new JMenuItem("Start");
    mntmInfraSOLRStart.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "solr_start");
        }
    });
    mnSOLR.add(mntmInfraSOLRStart);

    JMenuItem mntmInfraSOLRStop = new JMenuItem("Stop");
    mntmInfraSOLRStop.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "solr_stop");
        }
    });
    mnSOLR.add(mntmInfraSOLRStop);

    mnInfrastructure.add(mnSOLR);

    // MySQL options
    JMenu mnMySQL = new JMenu("MySQL");

    JMenuItem mntmInfraMysql = new JMenuItem("Download");
    mntmInfraMysql.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "download_mysql");
        }
    });
    mnMySQL.add(mntmInfraMysql);

    JMenuItem mntmInfraMysqlInstall = new JMenuItem("Install");
    mntmInfraMysqlInstall.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "install_mysql");
        }
    });
    mnMySQL.add(mntmInfraMysqlInstall);

    mnMySQL.addSeparator();

    JMenuItem mntmInfraMysqlStart = new JMenuItem("Start");
    mntmInfraMysqlStart.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "mysql_start");
        }
    });
    mnMySQL.add(mntmInfraMysqlStart);

    JMenuItem mntmInfraMysqlStop = new JMenuItem("Stop");
    mntmInfraMysqlStop.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "mysql_stop");
        }
    });
    mnMySQL.add(mntmInfraMysqlStop);

    mnInfrastructure.add(mnMySQL);

    // FFMPEPG options
    JMenu mnFFMPEG = new JMenu("FFMPEG");

    JMenuItem mntmInfraFFMPEG = new JMenuItem("Download");
    mntmInfraFFMPEG.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "download_ffmpeg");
        }
    });
    mnFFMPEG.add(mntmInfraFFMPEG);

    JMenuItem mntmInfraFFMPEGInstall = new JMenuItem("Install");
    mntmInfraFFMPEGInstall.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "install_ffmpeg");
        }
    });
    mnFFMPEG.add(mntmInfraFFMPEGInstall);

    mnInfrastructure.add(mnFFMPEG);

    // Apache James options
    JMenu mnJames = new JMenu("James SMTP");

    JMenuItem mnJamesStart = new JMenuItem("Start");
    mnJamesStart.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "james_start");
        }
    });
    mnJames.add(mnJamesStart);

    JMenuItem mnJamesStop = new JMenuItem("Stop");
    mnJamesStop.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "james_stop");
        }
    });
    mnJames.add(mnJamesStop);

    mnInfrastructure.add(mnJames);

    mnInfrastructure.addSeparator();

    JMenuItem mntmInfraInstall = new JMenuItem("All in One Setup");
    mntmInfraInstall.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "infrastructure");
        }
    });
    mnInfrastructure.add(mntmInfraInstall);

    JMenu mnOther = new JMenu("Other");
    menuBar.add(mnOther);

    JMenu mntmAemDownload = new JMenu("AEM & License files (VPN)");

    JMenuItem mntmAemDownloadAEM61 = new JMenuItem("Download AEM 6.1");
    mntmAemDownloadAEM61.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "download_aem61");
        }
    });
    mntmAemDownload.add(mntmAemDownloadAEM61);

    JMenuItem mntmAemDownloadAEM60 = new JMenuItem("Download AEM 6.0");
    mntmAemDownloadAEM60.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "download_aem60");
        }
    });
    mntmAemDownload.add(mntmAemDownloadAEM60);

    JMenuItem mntmAemDownloadCQ561 = new JMenuItem("Download CQ 5.6.1");
    mntmAemDownloadCQ561.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "download_cq561");
        }
    });
    mntmAemDownload.add(mntmAemDownloadCQ561);

    JMenuItem mntmAemDownloadCQ56 = new JMenuItem("Download CQ 5.6");
    mntmAemDownloadCQ56.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "download_cq56");
        }
    });
    mntmAemDownload.add(mntmAemDownloadCQ56);

    JMenuItem mntmAemDownloadOthers = new JMenuItem("Other Releases & License files");
    mntmAemDownloadOthers.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.openWebpage(AemDemoUtils.getActualPropertyValue(defaultProperties, personalProperties,
                    AemDemoConstants.OPTIONS_DOWNLOAD));
        }
    });
    mntmAemDownload.add(mntmAemDownloadOthers);

    mnOther.add(mntmAemDownload);

    JMenuItem mntmAemSnapshot = new JMenuItem("Download Latest AEM Snapshot (VPN)");
    mntmAemSnapshot.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_T, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    mntmAemSnapshot.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "download_snapshot");
        }
    });
    mnOther.add(mntmAemSnapshot);

    JMenuItem mntmAemDemoMachine = new JMenuItem("Download Latest AEM Demo Machine");
    mntmAemDemoMachine.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_D, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    mntmAemDemoMachine.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.openWebpage(AemDemoUtils.getActualPropertyValue(defaultProperties, personalProperties,
                    AemDemoConstants.OPTIONS_DEMODOWNLOAD));
        }
    });
    mnOther.add(mntmAemDemoMachine);

    // Adding the menu bar
    frameMain.setJMenuBar(menuBar);

    // Adding other form elements
    JScrollPane scrollPane = new JScrollPane();
    scrollPane.setBounds(24, 184, 650, 230);
    frameMain.getContentPane().add(scrollPane);

    final JTextArea textArea = new JTextArea("");
    textArea.setEditable(false);
    scrollPane.setViewportView(textArea);

    // List of demo machines available
    JScrollPane scrollDemoList = new JScrollPane();
    scrollDemoList.setBounds(24, 55, 208, 100);
    frameMain.getContentPane().add(scrollDemoList);
    listModelDemoMachines = AemDemoUtils.listDemoMachines(buildFile.getParentFile().getAbsolutePath());
    listDemoMachines = new JList(listModelDemoMachines);
    scrollDemoList.setViewportView(listDemoMachines);

    // Capturing the output stream of ANT commands
    AemDemoOutputStream out = new AemDemoOutputStream(textArea);
    System.setOut(new PrintStream(out));

    JButton btnStart = new JButton("Start");
    btnStart.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {

            AemDemoUtils.antTarget(AemDemo.this, "start");

        }
    });
    btnStart.setBounds(250, 50, 117, 29);
    frameMain.getContentPane().add(btnStart);

    // Set Start as the default button
    JRootPane rootPane = SwingUtilities.getRootPane(btnStart);
    rootPane.setDefaultButton(btnStart);

    JButton btnInfo = new JButton("Details");
    btnInfo.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {

            AemDemoUtils.antTarget(AemDemo.this, "version");
            AemDemoUtils.antTarget(AemDemo.this, "configuration");

        }
    });
    btnInfo.setBounds(250, 80, 117, 29);
    frameMain.getContentPane().add(btnInfo);

    JButton btnStop = new JButton("Stop");
    btnStop.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {

            AemDemoUtils.antTarget(AemDemo.this, "stop");

        }
    });
    btnStop.setBounds(500, 50, 117, 29);
    frameMain.getContentPane().add(btnStop);

    JButton btnExit = new JButton("Exit");
    btnExit.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            System.exit(-1);
        }
    });
    btnExit.setBounds(550, 429, 117, 29);
    frameMain.getContentPane().add(btnExit);

    JButton btnClear = new JButton("Clear");
    btnClear.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            textArea.setText("");
        }
    });
    btnClear.setBounds(40, 429, 117, 29);
    frameMain.getContentPane().add(btnClear);

    JButton btnBackup = new JButton("Backup");
    btnBackup.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "backup");
        }
    });
    btnBackup.setBounds(500, 80, 117, 29);
    frameMain.getContentPane().add(btnBackup);

    JButton btnRestore = new JButton("Restore");
    btnRestore.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "restore");
        }
    });
    btnRestore.setBounds(500, 110, 117, 29);
    frameMain.getContentPane().add(btnRestore);

    JButton btnDelete = new JButton("Delete");
    btnDelete.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "uninstall");
        }
    });
    btnDelete.setBounds(500, 140, 117, 29);
    frameMain.getContentPane().add(btnDelete);

    JLabel lblSelectYourDemo = new JLabel("Select your Demo Environment");
    lblSelectYourDemo.setBounds(24, 31, 219, 16);
    frameMain.getContentPane().add(lblSelectYourDemo);

    JLabel lblCommandOutput = new JLabel("Command Output");
    lblCommandOutput.setBounds(24, 164, 160, 16);
    frameMain.getContentPane().add(lblCommandOutput);

    // Launching the download tracker task
    AemDemoDownload aemDownload = new AemDemoDownload(AemDemo.this);
    ScheduledExecutorService executor = Executors.newScheduledThreadPool(1);
    executor.scheduleAtFixedRate(aemDownload, 0, 5, TimeUnit.SECONDS);

}