Example usage for java.awt.event MouseEvent getComponent

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

Introduction

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

Prototype

public Component getComponent() 

Source Link

Document

Returns the originator of the event.

Usage

From source file:org.parosproxy.paros.view.OutputPanel.java

/**
 * This method initializes txtOutput   /*  ww  w .  j a  v a2 s. c  o  m*/
 *    
 * @return org.zaproxy.zap.utils.ZapTextArea   
 */
private ZapTextArea getTxtOutput() {
    if (txtOutput == null) {
        txtOutput = new ZapTextArea();
        txtOutput.setEditable(false);
        txtOutput.setLineWrap(true);
        txtOutput.setName("");
        txtOutput.addMouseListener(new java.awt.event.MouseAdapter() {

            @Override
            public void mousePressed(java.awt.event.MouseEvent e) {
                showPopupMenuIfTriggered(e);
            }

            @Override
            public void mouseReleased(java.awt.event.MouseEvent e) {
                showPopupMenuIfTriggered(e);
            }

            private void showPopupMenuIfTriggered(java.awt.event.MouseEvent e) {
                if (e.isPopupTrigger()) {
                    View.getSingleton().getPopupMenu().show(e.getComponent(), e.getX(), e.getY());
                }
            }

        });
    }
    return txtOutput;
}

From source file:org.zaproxy.zap.extension.encoder2.EncodeDecodeDialog.java

private ZapTextArea getInputField() {
    if (inputField == null) {
        inputField = newField(true);/* w  w  w . j  ava  2  s  . c o  m*/
        inputField.setName(ENCODE_DECODE_FIELD);

        inputField.getDocument().addDocumentListener(new DocumentListener() {
            @Override
            public void insertUpdate(DocumentEvent documentEvent) {
                updateEncodeDecodeFields();
            }

            @Override
            public void removeUpdate(DocumentEvent documentEvent) {
                updateEncodeDecodeFields();
            }

            @Override
            public void changedUpdate(DocumentEvent documentEvent) {
            }
        });

        inputField.addMouseListener(new java.awt.event.MouseAdapter() {
            @Override
            public void mousePressed(java.awt.event.MouseEvent e) {
                if (SwingUtilities.isRightMouseButton(e)) {
                    View.getSingleton().getPopupMenu().show(e.getComponent(), e.getX(), e.getY());
                }
            }
        });
    }
    return inputField;
}

From source file:nz.govt.natlib.ndha.manualdeposit.bulkupload.BulkUploadPresenter.java

private void tblJobListMouseReleased(final java.awt.event.MouseEvent evt) {
    if (evt.isPopupTrigger()) {
        if (theJobListTable.getSelectedRowCount() == 0) {
            final int row = theJobListTable.rowAtPoint(evt.getPoint());
            if (row > -1) {
                theJobListTable.setRowSelectionInterval(row, row);
            }//  ww w.  j ava2  s.  c  om
        }
        final JPopupMenu menu = bulkUploadManager.getBulkUploadMenu();
        if (menu != null) {
            menu.show(evt.getComponent(), evt.getX(), evt.getY());
        }

    }
}

From source file:nz.govt.natlib.ndha.manualdeposit.bulkupload.BulkUploadPresenter.java

private void tableMouseClicked(final java.awt.event.MouseEvent evt) {
    if (evt.isPopupTrigger()) {
        if (theJobListTable.getSelectedRowCount() == 0) {
            final int row = theJobListTable.rowAtPoint(evt.getPoint());
            if (row > -1) {
                theJobListTable.setRowSelectionInterval(row, row);
            }/*from  w  ww  . j  a v a 2s  .c o  m*/
        }
        final JPopupMenu menu = bulkUploadManager.getBulkUploadMenu();
        if (menu != null) {
            menu.show(evt.getComponent(), evt.getX(), evt.getY());
        }

    }
}

From source file:com.yosanai.java.aws.console.panel.InstancesPanel.java

public void showPopup(MouseEvent e) {
    if (e.isPopupTrigger()) {
        tblPopup.show(e.getComponent(), e.getX(), e.getY());
    }
}

From source file:net.sf.mzmine.desktop.impl.projecttree.ProjectTreeMouseHandler.java

private void handlePopupTriggerEvent(MouseEvent e) {
    TreePath clickedPath = tree.getPathForLocation(e.getX(), e.getY());
    if (clickedPath == null)
        return;/*w  w  w .ja  v  a  2s  . c  o m*/
    DefaultMutableTreeNode node = (DefaultMutableTreeNode) clickedPath.getLastPathComponent();
    Object clickedObject = node.getUserObject();

    if (clickedObject instanceof RawDataFile)
        dataFilePopupMenu.show(e.getComponent(), e.getX(), e.getY());
    if (clickedObject instanceof Scan)
        scanPopupMenu.show(e.getComponent(), e.getX(), e.getY());
    if (clickedObject instanceof MassList)
        massListPopupMenu.show(e.getComponent(), e.getX(), e.getY());
    if (clickedObject instanceof PeakList)
        peakListPopupMenu.show(e.getComponent(), e.getX(), e.getY());
    if (clickedObject instanceof PeakListRow)
        peakListRowPopupMenu.show(e.getComponent(), e.getX(), e.getY());
}

From source file:com.sec.ose.osi.ui.frm.main.report.project.JListProjectWithPopup.java

private void initialize() {
    this.addListSelectionListener(new FileSelectionListener());
    this.addMouseListener(new MouseAdapter() {
        @SuppressWarnings("deprecation")
        public void mouseClicked(MouseEvent e) {
            if (e.getButton() == MouseEvent.BUTTON3) {
                log.debug("JLIstProjectWithPop.mouseClicked() : MouseEvent.BUTTON3");
                /// clicked right button
                mEventHandler.handle(EventHandler.RIGHT_BTN_CLICKED);

                if (JListProjectWithPopup.this.getSelectedValues() != null // existed selected item
                        && JListProjectWithPopup.this.getSelectedValues().length > 0) {
                    log.debug("button3");
                    mPopup.show(e.getComponent(), e.getX(), e.getY());
                }// w ww.  j a  v a  2  s  .c  om
            }
        }
    });
}

From source file:com.mirth.connect.client.ui.components.MirthTreeTable.java

public void setMirthColumnControlEnabled(boolean enable) {
    if (enable) {
        if (rightClickMouseAdapter == null) {
            rightClickMouseAdapter = new MouseAdapter() {
                public void mouseClicked(MouseEvent e) {
                    if (SwingUtilities.isRightMouseButton(e)) {
                        getColumnMenu().show(e.getComponent(), e.getX(), e.getY());
                    }/*from  ww  w.ja v a2 s . c o m*/
                }
            };

            getTableHeader().addMouseListener(rightClickMouseAdapter);
        }
    } else {
        if (rightClickMouseAdapter != null) {
            getTableHeader().removeMouseListener(rightClickMouseAdapter);
            rightClickMouseAdapter = null;
        }
    }

    setColumnControlVisible(enable);
}

From source file:org.eevolution.form.VCRPDetail.java

private void handleTreeEvent(MouseEvent e) {

    if (e.getButton() == MouseEvent.BUTTON3) {

        model.getTree().setSelectionPath(model.getTree().getPathForLocation(e.getX(), e.getY()));

        DefaultMutableTreeNode node = (DefaultMutableTreeNode) model.getTree().getSelectionPath()
                .getLastPathComponent();

        if (!(node.getUserObject() instanceof Date) && !(node.getUserObject() instanceof MPPOrderNode)) {

            popup.show(e.getComponent(), e.getX(), e.getY());
        }/*w  w w.j  a v  a  2s.  c o  m*/
    }

    SwingTool.setCursorsFromChild(e.getComponent(), false);
}

From source file:org.kepler.gui.popups.OutlinePopupListener.java

/**
 * /*  ww  w. j a va 2  s  .c o  m*/
 * @param selPath
 * @param e
 */
private void handlePopupOutsideKar(TreePath selPath, MouseEvent e) {

    Object ob = selPath.getLastPathComponent();
    if (isDebugging)
        log.debug(ob.getClass().getName());

    if (ob instanceof NamedObj) {

        NamedObj no = (NamedObj) ob;
        String alternateLibraryPopupClassName = _getAlternateLibraryPopupClassName(no);
        if (alternateLibraryPopupClassName == null) {
            OutlineComponentPopup kcp = new OutlineComponentPopup(selPath, _aptree.getParentComponent());
            kcp.initialize();
            _aptree.add(kcp);
            _aptree.setSelectionPath(selPath);
            kcp.show(e.getComponent(), e.getX(), e.getY());
        } else {
            try {
                Class<?> libraryPopupClass = Class.forName(alternateLibraryPopupClassName);
                Object object = libraryPopupClass.newInstance();
                Method getPopupMethod = libraryPopupClass.getMethod("getPopup", JTree.class, MouseEvent.class,
                        TreePath.class, Component.class);
                getPopupMethod.invoke(object, _aptree, e, selPath, _aptree.getParentComponent());
            } catch (Exception w) {
                log.error("Error creating alternateGetLibraryPopup!", w);
            }
        }
    }
}