Example usage for java.awt.event MouseEvent getID

List of usage examples for java.awt.event MouseEvent getID

Introduction

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

Prototype

public int getID() 

Source Link

Document

Returns the event type.

Usage

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

private void selectionChart(DBBrowserNode selectedNode, MouseEvent e, boolean pressed) {
    OpenChartAction openAction = new OpenChartAction();
    openAction.setChartName(selectedNode.getDBObject().getName());
    openAction.setChartPath(selectedNode.getDBObject().getAbsolutePath());

    if (e.getClickCount() == 2) {
        if (pressed) {
            openAction.actionPerformed(new ActionEvent(e.getSource(), e.getID(), ""));
        }//from  ww  w  .j a  v a 2 s  .com

    } else {
        JPopupMenu popupMenu = new JPopupMenu();
        JMenuItem menuItem = new JMenuItem(openAction);
        popupMenu.add(menuItem);

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

        RenameChartAction renameAction = new RenameChartAction(instance, selectedNode);
        JMenuItem menuItem3 = new JMenuItem(renameAction);
        popupMenu.add(menuItem3);

        ExportChartAction exportAction = new ExportChartAction(instance, selectedNode);
        JMenuItem menuItem4 = new JMenuItem(exportAction);
        popupMenu.add(menuItem4);

        Chart chart = ChartUtil.loadChart(selectedNode.getDBObject().getAbsolutePath());
        PreviewChartAction previewHTML5Action = new PreviewChartAction(ChartRunner.GRAPHIC_FORMAT,
                ChartRunner.HTML5_TYPE, I18NSupport.getString("preview.html5"));
        previewHTML5Action.setChart(chart);
        popupMenu.add(previewHTML5Action);
        PreviewChartAction previewFlashAction = new PreviewChartAction(ChartRunner.GRAPHIC_FORMAT,
                ChartRunner.FLASH_TYPE, I18NSupport.getString("preview.flash"));
        previewFlashAction.setChart(chart);
        popupMenu.add(previewFlashAction);
        previewFlashAction.setEnabled(!ChartType.hasNoFlashSupport(chart.getType().getType()));
        PreviewChartAction previewImageAction = new PreviewChartAction(ChartRunner.IMAGE_FORMAT,
                ChartRunner.NO_TYPE, I18NSupport.getString("preview.image"));
        previewImageAction.setChart(chart);
        popupMenu.add(previewImageAction);

        PublishChartAction publishAction = new PublishChartAction(selectedNode.getDBObject().getAbsolutePath());
        JMenuItem menuItem5 = new JMenuItem(publishAction);
        popupMenu.add(menuItem5);

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

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

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

From source file:thesaurusEditor.gui.graph.MainGraph.java

protected void processMouseEvent(MouseEvent e) {
    if (e.getID() == MouseEvent.MOUSE_ENTERED) {
        this.requestFocus();
    }/*from   ww  w.  ja  va 2 s  .c  o  m*/
}