Example usage for java.awt.event ActionEvent ActionEvent

List of usage examples for java.awt.event ActionEvent ActionEvent

Introduction

In this page you can find the example usage for java.awt.event ActionEvent ActionEvent.

Prototype

public ActionEvent(Object source, int id, String command) 

Source Link

Document

Constructs an ActionEvent object.

Usage

From source file:org.apache.jmeter.JMeter.java

/**
 * Starts up JMeter in GUI mode/*from ww w.  j av a  2s . c  o  m*/
 */
private void startGui(String testFile) {
    String jMeterLaf = LookAndFeelCommand.getJMeterLaf();
    try {
        UIManager.setLookAndFeel(jMeterLaf);
    } catch (Exception ex) {
        log.warn("Could not set LAF to:" + jMeterLaf, ex);
    }

    PluginManager.install(this, true);

    JMeterTreeModel treeModel = new JMeterTreeModel();
    JMeterTreeListener treeLis = new JMeterTreeListener(treeModel);
    final ActionRouter instance = ActionRouter.getInstance();
    instance.populateCommandMap();
    treeLis.setActionHandler(instance);
    // NOTUSED: GuiPackage guiPack =
    GuiPackage.getInstance(treeLis, treeModel);
    MainFrame main = new MainFrame(treeModel, treeLis);
    ComponentUtil.centerComponentInWindow(main, 80);
    main.setVisible(true);
    instance.actionPerformed(new ActionEvent(main, 1, ActionNames.ADD_ALL));
    if (testFile != null) {
        try {
            File f = new File(testFile);
            log.info("Loading file: " + f);
            FileServer.getFileServer().setBaseForScript(f);

            HashTree tree = SaveService.loadTree(f);

            GuiPackage.getInstance().setTestPlanFile(f.getAbsolutePath());

            Load.insertLoadedTree(1, tree);
        } catch (ConversionException e) {
            log.error("Failure loading test file", e);
            JMeterUtils.reportErrorToUser(SaveService.CEtoString(e));
        } catch (Exception e) {
            log.error("Failure loading test file", e);
            JMeterUtils.reportErrorToUser(e.toString());
        }
    } else {
        JTree jTree = GuiPackage.getInstance().getMainFrame().getTree();
        TreePath path = jTree.getPathForRow(0);
        jTree.setSelectionPath(path);
        FocusRequester.requestFocus(jTree);
    }
}

From source file:fur.shadowdrake.minecraft.InstallPanel.java

public void begin(boolean first) {
    workingDir = dirBox.getText();//from  w  ww . j  a  va2  s  .c o m
    workingPack = (String) modpackChooser.getSelectedItem();
    parentFrame.dropAllProceedListeners();
    new Thread(() -> {
        try {
            JTabbedPane tabPane;
            tabPane = (JTabbedPane) getParent();

            if (force.isSelected()) {
                log.println("Cleaning up.");
                cleanUp(new File(workingDir));
                Manifest mf = manifest.get(workingPack);
                if (mf != null) {
                    mf.clear();
                }
            }

            Pack detected = detectPack(new File(workingDir));
            if ((detected == null) && checkDir(new File(workingDir), 2)) {
                try {
                    EventQueue.invokeAndWait(() -> {
                        JOptionPane.showMessageDialog(parentFrame,
                                "This directory contains an unknown modpack.\nChoose another directory or force reinstall.");
                    });
                } catch (InterruptedException | InvocationTargetException ex) {
                }
                completedListener.actionPerformed(new ActionEvent(this, 2, "Install"));
            } else if (detected == null) {
                try {
                    EventQueue.invokeAndWait(() -> {
                        tabPane.remove(this);
                    });
                } catch (InterruptedException | InvocationTargetException ex) {
                }

                if (first && !addonsOpenedOnce) {
                    addonsPanel = new AddonsPanel(
                            availablePacks.get(modpackChooser.getSelectedIndex()).addons.toArray(new Addon[0]));
                    tabPane.add("Addons", addonsPanel);
                    tabPane.setSelectedComponent(addonsPanel);
                    addonsOpenedOnce = true;
                    parentFrame.setAbortListener((ActionEvent e) -> {
                        tabPane.remove(addonsPanel);
                        tabPane.add("Install", this);
                        tabPane.setSelectedComponent(this);
                        parentFrame.setProceedListener((ActionEvent ev) -> {
                            begin(false);
                        });
                        parentFrame.setAbortListener((ActionEvent ev) -> {
                            tabPane.remove(this);
                            parentFrame.state = 0;
                            parentFrame.dropAllAbortListeners();
                            parentFrame.dropAllProceedListeners();
                        });
                    });
                    parentFrame.setProceedListener((ActionEvent e) -> {
                        tabPane.remove(addonsPanel);
                        boolean s[];
                        s = addonsPanel.getSelected();
                        for (int n = 0; n < s.length; n++) {
                            availablePacks.get(modpackChooser.getSelectedIndex()).addons.get(n).install = s[n];
                        }
                        begin(false);
                    });
                    return;
                }

                if (downloadPack() && downloadAddons() && doPostDownload()) {
                    log.println("Installation completed successful.");
                    log.setStatusText("Ok");
                    completedListener.actionPerformed(new ActionEvent(this, 1, "Install"));
                } else {
                    log.println("Installation completed with errors.");
                    log.setStatusText("Error");
                    EventQueue.invokeLater(() -> {
                        JOptionPane.showMessageDialog(parentFrame, "Installation failed");
                    });
                    completedListener.actionPerformed(new ActionEvent(this, 0, "Install"));
                }
            } else if (detected.name.equals(modpackChooser.getSelectedItem())) {
                if (!isInstalled(detected)) {
                    try {
                        Gson gson = new GsonBuilder().create();
                        tabPane.remove(this);
                        packList.add(detected);

                        String latestVersion = ftpClient.getLatestVersion(detected.name);
                        if (!latestVersion.equals(detected.version)) {
                            updatePack(detected);
                        }

                        try (FileWriter fw = new FileWriter(
                                new File(config.getInstallDir(), "modpacks.json"))) {
                            gson.toJson(packList, fw);
                        }
                        log.println("Installation completed successful.");
                        completedListener.actionPerformed(new ActionEvent(this, 1, "Install"));
                    } catch (IOException ex1) {
                        log.println("Installation failed.");
                        Logger.getLogger(InstallPanel.class.getName()).log(Level.SEVERE, null, ex1);
                    }
                } else {
                    try {
                        EventQueue.invokeAndWait(() -> {
                            tabPane.remove(this);
                        });
                    } catch (InterruptedException | InvocationTargetException ex) {
                    }
                    if (downloadAddons()) {
                        log.println("Installation completed successful.");
                        log.setStatusText("Ok");
                        log.reset();
                        completedListener.actionPerformed(new ActionEvent(this, 1, "Install"));
                    } else {
                        log.println("Installation failed.");
                        EventQueue.invokeLater(() -> {
                            JOptionPane.showMessageDialog(parentFrame, "Installation failed");
                        });
                    }
                }
            } else {
                try {
                    EventQueue.invokeAndWait(() -> {
                        JOptionPane.showMessageDialog(parentFrame, "This directory contains modpack "
                                + detected.name + ".\nSelect the correct pack or force reinstall.");
                    });
                } catch (InterruptedException | InvocationTargetException ex) {
                }
                completedListener.actionPerformed(new ActionEvent(this, 2, "Install"));
            }
            writeFiles();
        } catch (NetworkException ex) {
            Logger.getLogger(InstallPanel.class.getName()).log(Level.SEVERE, null, ex);
            JOptionPane.showMessageDialog(parentFrame, ex.getMessage(), "Network error",
                    JOptionPane.ERROR_MESSAGE);
            ftpClient.close();
            log.println(
                    "Timeout. Previous command wasn't received by the server. This is a network error. Please try again later.");
            log.setStatusText("Error");
        }
    }, "Installer").start();
}

From source file:com.limegroup.gnutella.gui.GUIUtils.java

/**
 * Returns a <code>MouseListener</code> that changes the cursor and
 * notifies <code>actionListener</code> on click.
 *///from  w  w w  .ja va  2 s  .  c om
public static MouseListener getURLInputListener(final ActionListener actionListener) {
    return new MouseAdapter() {
        public void mouseEntered(MouseEvent e) {
            JComponent comp = (JComponent) e.getComponent();
            comp.getTopLevelAncestor().setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        }

        public void mouseExited(MouseEvent e) {
            JComponent comp = (JComponent) e.getComponent();
            comp.getTopLevelAncestor().setCursor(Cursor.getDefaultCursor());
        }

        public void mouseClicked(MouseEvent e) {
            actionListener.actionPerformed(new ActionEvent(e.getComponent(), 0, null));
        }
    };
}

From source file:org.photovault.swingui.BrowserWindow.java

protected void createUI(PhotoCollection collection) {
    window.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    tabPane = new JTabbedPane();
    queryPane = new QueryPane();
    PhotoFolderTreeController treeCtrl = new PhotoFolderTreeController(window, this);
    viewCtrl = new PhotoViewController(window, this);
    treePane = treeCtrl.folderTree;//from   ww  w.jav a  2  s  .c  om
    viewPane = viewCtrl.getThumbPane();
    previewPane = viewCtrl.getPreviewPane();
    tabPane.addTab("Query", queryPane);
    tabPane.addTab("Folders", treePane);

    VolumeTreeController volTreeCtrl = new VolumeTreeController(this);
    JTree volumeTree = volTreeCtrl.getView();
    JScrollPane voltreeScrollPane = new JScrollPane(volumeTree);
    voltreeScrollPane.setPreferredSize(new Dimension(200, 500));
    tabPane.add("Volumes", voltreeScrollPane);

    // TODO: get rid of this!!!!
    EditSelectionColorsAction colorAction = (EditSelectionColorsAction) viewPane.getEditSelectionColorsAction();
    colorAction.setPreviewCtrl(previewPane);

    // Set listeners to both query and folder tree panes

    /*
    If an actionEvent comes from query pane, swich to query results.
     */
    queryPane.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            viewCtrl.setCollection(queryPane.getResultCollection());
        }
    });

    /*
    If the selected folder is changed in treePane, switch to that immediately
     */

    treeCtrl.registerEventListener(PhotoFolderTreeEvent.class, new DefaultEventListener<PhotoCollection>() {

        public void handleEvent(DefaultEvent<PhotoCollection> event) {
            PhotoCollection c = event.getPayload();
            if (c != null) {
                viewCtrl.setCollection(c);
                if (c instanceof PhotoFolder) {
                    PhotoFolder f = (PhotoFolder) c;

                    if (f.getExternalDir() != null) {
                        ExternalDir ed = f.getExternalDir();
                        folderIndexer.updateDir(ed.getVolume(), ed.getPath());
                        viewCtrl.setIndexingOngoing(true);
                    }
                }
            }
        }
    });

    volTreeCtrl.registerEventListener(PhotoFolderTreeEvent.class, new DefaultEventListener<PhotoCollection>() {

        public void handleEvent(DefaultEvent<PhotoCollection> event) {
            PhotoCollection c = event.getPayload();
            if (c != null) {
                viewCtrl.setCollection(c);
                if (c instanceof ExtDirPhotos) {
                    ExtDirPhotos photos = (ExtDirPhotos) c;
                    ExternalVolume vol = (ExternalVolume) viewCtrl.getDAOFactory().getVolumeDAO()
                            .getVolume(photos.getVolId());
                    folderIndexer.updateDir(vol, photos.getDirPath());
                    viewCtrl.setIndexingOngoing(true);
                }
            }
        }
    });

    collectionPane = viewCtrl.getCollectionPane();

    JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, tabPane, collectionPane);
    split.putClientProperty(JSplitPane.ONE_TOUCH_EXPANDABLE_PROPERTY, new Boolean(true));
    Container cp = window.getContentPane();
    cp.setLayout(new BorderLayout());
    cp.add(split, BorderLayout.CENTER);

    statusBar = new StatusBar();
    cp.add(statusBar, BorderLayout.SOUTH);

    // Create actions for BrowserWindow UI

    ImageIcon indexDirIcon = getIcon("index_dir.png");
    DefaultAction indexDirAction = new DefaultAction("Index directory...", indexDirIcon) {

        public void actionPerformed(ActionEvent e) {
            indexDir();
        }
    };
    indexDirAction.putValue(AbstractAction.MNEMONIC_KEY, KeyEvent.VK_D);
    indexDirAction.putValue(AbstractAction.SHORT_DESCRIPTION, "Index all images in a directory");
    this.registerAction("new_ext_vol", indexDirAction);

    ImageIcon importIcon = getIcon("import.png");
    importAction = new AbstractAction("Import image...", importIcon) {

        public void actionPerformed(ActionEvent e) {
            importFile();
        }
    };
    importAction.putValue(AbstractAction.MNEMONIC_KEY, KeyEvent.VK_O);
    importAction.putValue(AbstractAction.ACCELERATOR_KEY,
            KeyStroke.getKeyStroke(KeyEvent.VK_O, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));

    importAction.putValue(AbstractAction.SHORT_DESCRIPTION, "Import new image into database");

    ImageIcon updateIcon = getIcon("update_indexed_dirs.png");
    UpdateIndexAction updateIndexAction = new UpdateIndexAction(viewCtrl, "Update indexed dirs", updateIcon,
            "Check for changes in previously indexed directories", KeyEvent.VK_U);
    this.registerAction("update_indexed_dirs", updateIndexAction);
    updateIndexAction.addStatusChangeListener(statusBar);

    ImageIcon previewTopIcon = getIcon("view_preview_top.png");
    DefaultAction previewTopAction = new DefaultAction("Preview on top", previewTopIcon) {

        public void actionPerformed(ActionEvent e) {
            viewCtrl.setLayout(PhotoViewController.Layout.PREVIEW_HORIZONTAL_THUMBS);
        }
    };
    previewTopAction.putValue(AbstractAction.SHORT_DESCRIPTION, "Show preview on top of thumbnails");
    previewTopAction.putValue(AbstractAction.MNEMONIC_KEY, KeyEvent.VK_T);
    this.registerAction("view_preview_top", previewTopAction);

    ImageIcon previewRightIcon = getIcon("view_preview_right.png");
    DefaultAction previewRightAction = new DefaultAction("Preview on right", previewRightIcon) {

        public void actionPerformed(ActionEvent e) {
            viewCtrl.setLayout(PhotoViewController.Layout.PREVIEW_VERTICAL_THUMBS);
        }
    };
    previewRightAction.putValue(AbstractAction.SHORT_DESCRIPTION, "Show preview on right of thumbnails");
    previewRightAction.putValue(AbstractAction.MNEMONIC_KEY, KeyEvent.VK_R);
    this.registerAction("view_preview_right", previewRightAction);

    ImageIcon previewNoneIcon = getIcon("view_no_preview.png");
    DefaultAction previewNoneAction = new DefaultAction("No preview", previewNoneIcon) {

        public void actionPerformed(ActionEvent e) {
            viewCtrl.setLayout(PhotoViewController.Layout.ONLY_THUMBS);
        }
    };
    previewNoneAction.putValue(AbstractAction.SHORT_DESCRIPTION, "Show no preview image");
    previewNoneAction.putValue(AbstractAction.MNEMONIC_KEY, KeyEvent.VK_O);
    this.registerAction("view_no_preview", previewNoneAction);

    DefaultAction previewLargeAction = new DefaultAction("Large", null) {

        public void actionPerformed(ActionEvent e) {
            viewCtrl.setPreviewSize(200);
        }
    };
    DefaultAction previewSmallAction = new DefaultAction("Small", null) {

        public void actionPerformed(ActionEvent e) {
            viewCtrl.setPreviewSize(100);
        }
    };

    JToolBar tb = createToolbar();
    cp.add(tb, BorderLayout.NORTH);

    // Create the menu bar & menus
    JMenuBar menuBar = new JMenuBar();
    window.setJMenuBar(menuBar);
    // File menu
    JMenu fileMenu = new JMenu("File");
    fileMenu.setMnemonic(KeyEvent.VK_F);
    menuBar.add(fileMenu);

    JMenuItem newWindowItem = new JMenuItem("New window", KeyEvent.VK_N);
    newWindowItem.setIcon(getIcon("window_new.png"));
    newWindowItem.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            BrowserWindow br = new BrowserWindow(getParentController(), null);
            //          br.setVisible( true );
        }
    });
    fileMenu.add(newWindowItem);

    JMenuItem importItem = new JMenuItem(importAction);
    fileMenu.add(importItem);

    JMenuItem indexDirItem = new JMenuItem(indexDirAction);
    fileMenu.add(indexDirItem);

    fileMenu.add(new JMenuItem(viewCtrl.getActionAdapter("update_indexed_dirs")));

    ExportSelectedAction exportAction = (ExportSelectedAction) viewPane.getExportSelectedAction();
    JMenuItem exportItem = new JMenuItem(exportAction);
    exportAction.addStatusChangeListener(statusBar);
    fileMenu.add(exportItem);

    JMenu dbMenu = new JMenu("Database");
    dbMenu.setMnemonic(KeyEvent.VK_B);
    dbMenu.setIcon(getIcon("empty_icon.png"));

    ExportMetadataAction exportMetadata = new ExportMetadataAction("Export as XML...", null,
            "Export whole database as XML file", KeyEvent.VK_E);
    dbMenu.add(new JMenuItem(exportMetadata));

    ImportXMLAction importMetadata = new ImportXMLAction("Import XML data...", null,
            "Import data from other Photovault database as XML", KeyEvent.VK_I);
    importMetadata.addStatusChangeListener(statusBar);
    dbMenu.add(new JMenuItem(importMetadata));

    fileMenu.add(dbMenu);

    JMenuItem exitItem = new JMenuItem("Exit", KeyEvent.VK_X);
    exitItem.setIcon(getIcon("exit.png"));
    exitItem.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            System.exit(0);
        }
    });
    fileMenu.add(exitItem);

    JMenu viewMenu = new JMenu("View");
    viewMenu.setMnemonic(KeyEvent.VK_V);
    menuBar.add(viewMenu);

    JMenuItem vertIconsItem = new JMenuItem(previewRightAction);
    viewMenu.add(vertIconsItem);

    JMenuItem horzIconsItem = new JMenuItem(previewTopAction);
    viewMenu.add(horzIconsItem);

    JMenuItem noPreviewItem = new JMenuItem(previewNoneAction);
    viewMenu.add(noPreviewItem);

    JMenuItem nextPhotoItem = new JMenuItem(viewPane.getSelectNextAction());
    viewMenu.add(nextPhotoItem);

    JMenuItem prevPhotoItem = new JMenuItem(viewPane.getSelectPreviousAction());
    viewMenu.add(prevPhotoItem);

    viewMenu.add(new JMenuItem(previewSmallAction));
    viewMenu.add(new JMenuItem(previewLargeAction));

    JMenu sortMenu = new JMenu("Sort by");
    sortMenu.setMnemonic(KeyEvent.VK_S);
    sortMenu.setIcon(getIcon("empty_icon.png"));
    JMenuItem byDateItem = new JMenuItem(new SetPhotoOrderAction(viewCtrl, new ShootingDateComparator(), "Date",
            null, "Order photos by date", KeyEvent.VK_D));
    sortMenu.add(byDateItem);
    JMenuItem byPlaceItem = new JMenuItem(new SetPhotoOrderAction(viewCtrl, new ShootingPlaceComparator(),
            "Place", null, "Order photos by shooting place", KeyEvent.VK_P));
    sortMenu.add(byPlaceItem);
    JMenuItem byQualityItem = new JMenuItem(new SetPhotoOrderAction(viewCtrl, new QualityComparator(),
            "Quality", null, "Order photos by quality", KeyEvent.VK_Q));
    sortMenu.add(byQualityItem);
    viewMenu.add(sortMenu);

    // Set default ordering by date
    byDateItem.getAction().actionPerformed(new ActionEvent(this, 0, "Setting default"));
    JMenu imageMenu = new JMenu("Image");
    imageMenu.setMnemonic(KeyEvent.VK_I);
    menuBar.add(imageMenu);

    imageMenu.add(new JMenuItem(viewPane.getEditSelectionPropsAction()));
    imageMenu.add(new JMenuItem(viewPane.getShowSelectedPhotoAction()));
    imageMenu.add(new JMenuItem(viewCtrl.getActionAdapter("rotate_cw")));
    imageMenu.add(new JMenuItem(viewCtrl.getActionAdapter("rotate_ccw")));
    imageMenu.add(new JMenuItem(viewCtrl.getActionAdapter("rotate_180")));
    imageMenu.add(new JMenuItem(previewPane.getCropAction()));
    imageMenu.add(new JMenuItem(viewPane.getEditSelectionColorsAction()));
    imageMenu.add(new JMenuItem(viewPane.getDeleteSelectedAction()));

    // Create the Quality submenu
    JMenu qualityMenu = new JMenu("Quality");
    qualityMenu.setIcon(getIcon("empty_icon.png"));

    for (int n = 0; n < 6; n++) {
        Action qualityAction = viewCtrl.getActionAdapter("quality_" + n);
        JMenuItem qualityMenuItem = new JMenuItem(qualityAction);
        qualityMenu.add(qualityMenuItem);
    }
    imageMenu.add(qualityMenu);

    JMenu aboutMenu = new JMenu("About");
    aboutMenu.setMnemonic(KeyEvent.VK_A);
    aboutMenu.add(new JMenuItem(new ShowAboutDlgAction("About Photovault...", null, "", null)));

    menuBar.add(Box.createHorizontalGlue());
    menuBar.add(aboutMenu);
    window.pack();
    window.setVisible(true);
}

From source file:net.mariottini.swing.JFontChooser.java

/**
 * Called when the user approves a font. Call this method to close the dialog and approve the
 * currently selected font./*from  w ww.  jav  a 2s  .  c om*/
 */
public void approveSelection() {
    ActionEvent event = new ActionEvent(this, ActionEvent.ACTION_PERFORMED, APPROVE_SELECTION);
    dispatchActionEvent(event);
}

From source file:de.juwimm.cms.Main.java

private void showAdminPanel() throws Exception {
    Constants.CMS_CLIENT_VIEW = Constants.CLIENT_VIEW_ADMIN;
    panRibbon.setView(false);//w ww . j a v  a2 s . c  om

    if (comm.isUserInRole(UserRights.SITE_ROOT)) {
        try {
            if (panRoot == null) {
                panRoot = new PanAdministrationRoot();
            }
            panRoot.reload();
        } catch (UserHasNoUnitsException ex) {
            JOptionPane.showMessageDialog(UIConstants.getMainFrame(), ex.getMessage(),
                    rb.getString("msgbox.title.loginFailed"), JOptionPane.ERROR_MESSAGE);
            ActionHub.fireActionPerformed(
                    new ActionEvent(this, ActionEvent.ACTION_PERFORMED, Constants.ACTION_LOGOFF));
            return;
        }
        setCenterPanel(panRoot);
    } else {
        try {
            if (panAdmin == null) {
                panAdmin = new PanAdministrationAdmin();
            }
            panAdmin.reload();
        } catch (UserHasNoUnitsException ex) {
            JOptionPane.showMessageDialog(UIConstants.getMainFrame(), ex.getMessage(),
                    rb.getString("msgbox.title.loginFailed"), JOptionPane.ERROR_MESSAGE);
            ActionHub.fireActionPerformed(
                    new ActionEvent(this, ActionEvent.ACTION_PERFORMED, Constants.ACTION_LOGOFF));
            return;
        }
        setCenterPanel(panAdmin);
    }
}

From source file:ro.nextreports.designer.querybuilder.DBBrowserTree.java

private void selectionQuery(DBBrowserNode selectedNode, MouseEvent e, boolean pressed) {
    OpenQueryAction openAction = new OpenQueryAction();
    openAction.setQueryName(selectedNode.getDBObject().getName());
    openAction.setQueryPath(selectedNode.getDBObject().getAbsolutePath());

    if (e.getClickCount() == 2) {
        if (pressed) {
            openAction.actionPerformed(new ActionEvent(e.getSource(), e.getID(), ""));
        }/*from   w  w w. ja  v  a 2 s.c om*/
    } else {
        JPopupMenu popupMenu = new JPopupMenu();
        JMenuItem menuItem = new JMenuItem(openAction);
        popupMenu.add(menuItem);

        NewReportFromQueryAction newReportQAction = new NewReportFromQueryAction();
        newReportQAction.setQueryName(selectedNode.getDBObject().getName());
        newReportQAction.setQueryPath(selectedNode.getDBObject().getAbsolutePath());
        JMenuItem menuItem3 = new JMenuItem(newReportQAction);
        popupMenu.add(menuItem3);

        NewChartFromQueryAction newChartQAction = new NewChartFromQueryAction();
        newChartQAction.setQueryName(selectedNode.getDBObject().getName());
        newChartQAction.setQueryPath(selectedNode.getDBObject().getAbsolutePath());
        JMenuItem menuItem6 = new JMenuItem(newChartQAction);
        popupMenu.add(menuItem6);

        DeleteQueryAction deleteAction = new DeleteQueryAction(instance, selectedNode);
        JMenuItem menuItem2 = new JMenuItem(deleteAction);//
        popupMenu.add(menuItem2);

        RenameQueryAction renameAction = new RenameQueryAction(instance, selectedNode);
        JMenuItem menuItem4 = new JMenuItem(renameAction);
        popupMenu.add(menuItem4);

        ExportQueryAction exportAction = new ExportQueryAction(instance, selectedNode);
        JMenuItem menuItem5 = new JMenuItem(exportAction);
        popupMenu.add(menuItem5);

        JMenuItem menuItem7 = new JMenuItem(new ValidateSqlsAction(selectedNode.getDBObject()));
        popupMenu.add(menuItem7);

        popupMenu.show((Component) e.getSource(), e.getX(), e.getY());
    }
}

From source file:net.mariottini.swing.JFontChooser.java

/**
 * Called when the user cancels the operation. Call this method to close the dialog without
 * selecting a font.//from ww  w .  j  a v a 2s  .com
 */
public void cancelSelection() {
    ActionEvent event = new ActionEvent(this, ActionEvent.ACTION_PERFORMED, CANCEL_SELECTION);
    dispatchActionEvent(event);
}

From source file:net.sf.jabref.EntryEditor.java

/**
 * Makes sure the current edit is stored.
 */// w ww  . java  2s  .c  om
public void storeCurrentEdit() {
    Component comp = Globals.focusListener.getFocused();
    if (comp == source || (comp instanceof FieldEditor && this.isAncestorOf(comp))) {
        if (comp instanceof FieldEditor) {
            ((FieldEditor) comp).clearAutoCompleteSuggestion();
        }
        storeFieldAction.actionPerformed(new ActionEvent(comp, 0, ""));
    }
}

From source file:de.juwimm.cms.content.panel.PanDocuments.java

private void btnFileActionPerformed(ActionEvent e) {
    if (e.getActionCommand().equals("CLICK")) {
        Enumeration en = bgrp.getElements();
        while (en.hasMoreElements()) {
            PanDocumentSymbol.JToggleBtt btn = (PanDocumentSymbol.JToggleBtt) en.nextElement();
            if (!btn.isSelected()) {
                btn.unClick();/*from www.  ja va  2s  .c  o  m*/
            } else {
                btn.doClick();
            }
        }
        intDocId = new Integer(bgrp.getSelection().getActionCommand());
        selectDocument(intDocId);
    } else {
        ActionEvent ae = new ActionEvent(this, ActionEvent.ACTION_PERFORMED, "CLICK");
        ((PanDocumentSymbol.JToggleBtt) e.getSource()).fireActionPerformedT(ae);
    }
}