Example usage for java.awt.event MouseEvent isPopupTrigger

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

Introduction

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

Prototype

public boolean isPopupTrigger() 

Source Link

Document

Returns whether or not this mouse event is the popup menu trigger event for the platform.

Usage

From source file:nz.govt.natlib.ndha.manualdeposit.ManualDepositMain.java

private void treeStructMapMouseReleased(java.awt.event.MouseEvent evt) {
    if (evt.isPopupTrigger()) {
        TreePath path = treeStructMap.getClosestPathForLocation(evt.getX(), evt.getY());
        if (path != null) {
            treeStructMap.setSelectionPath(path);
            DefaultMutableTreeNode node = (DefaultMutableTreeNode) path.getLastPathComponent();
            JPopupMenu menu = depositPresenter.getStructMapMenu(node);
            if (menu != null) {
                menu.show(evt.getComponent(), evt.getX(), evt.getY());
            }/*from   ww w. j  av a2s.c o m*/
        }
    }
}

From source file:nz.govt.natlib.ndha.manualdeposit.ManualDepositMain.java

private void treeEntitiesMouseReleased(java.awt.event.MouseEvent evt) {
    if (evt.isPopupTrigger()) {
        TreePath path = treeEntities.getClosestPathForLocation(evt.getX(), evt.getY());
        if (path != null) {
            treeEntities.setSelectionPath(path);
            DefaultMutableTreeNode node = (DefaultMutableTreeNode) path.getLastPathComponent();
            JPopupMenu menu = depositPresenter.getEntityMenu(node);
            if (menu != null) {
                menu.show(evt.getComponent(), evt.getX(), evt.getY());
            }/*from  w w  w . ja v  a  2 s  .co m*/
        }
    }
}

From source file:nz.govt.natlib.ndha.manualdeposit.ManualDepositMain.java

private void treeFileSystemMouseReleased(java.awt.event.MouseEvent evt) {
    if (evt.isPopupTrigger()) {
        TreePath path = treeFileSystem.getClosestPathForLocation(evt.getX(), evt.getY());
        if (path != null) {
            treeFileSystem.setSelectionPath(path);
            DefaultMutableTreeNode node = (DefaultMutableTreeNode) path.getLastPathComponent();
            JPopupMenu menu = depositPresenter.getFileSystemMenu(node);
            if (menu != null) {
                menu.show(evt.getComponent(), evt.getX(), evt.getY());
            }/*from   www. j  av a  2  s .c o m*/
        }
    }
}

From source file:nz.govt.natlib.ndha.manualdeposit.ManualDepositMain.java

private void treeFileSystemMousePressed(java.awt.event.MouseEvent evt) {
    if (evt.isPopupTrigger()) {
        TreePath path = treeFileSystem.getClosestPathForLocation(evt.getX(), evt.getY());
        if (path != null) {
            treeFileSystem.setSelectionPath(path);
            DefaultMutableTreeNode node = (DefaultMutableTreeNode) path.getLastPathComponent();
            JPopupMenu menu = depositPresenter.getFileSystemMenu(node);
            if (menu != null) {
                menu.show(evt.getComponent(), evt.getX(), evt.getY());
            }// ww w  .  j  a  v a 2s .c o  m
        }
    } else {
        setDragSourceFileSystem();
    }

}

From source file:org.archiviststoolkit.mydomain.DomainTableWorkSurface.java

/**
 * called when the mouse is pressed./*  w ww. ja  va2 s  . c  o m*/
 *
 * @param evt the mouse event
 */
public final void mousePressed(final MouseEvent evt) {
    if (evt.isPopupTrigger()) {
        pm.show(evt.getComponent(), evt.getX(), evt.getY());
    }

}

From source file:org.archiviststoolkit.mydomain.DomainTableWorkSurface.java

/**
 * called when the mouse is released./*from   w w  w  .j a v  a  2s  .  c om*/
 *
 * @param evt the mouse event
 */

public final void mouseReleased(final MouseEvent evt) {
    if (evt.isPopupTrigger()) {
        pm.show(evt.getComponent(), evt.getX(), evt.getY());
    }

}

From source file:org.bitbucket.mlopatkin.android.logviewer.widgets.UiHelper.java

public static void addPopupMenu(final JComponent component, final JPopupMenu menu) {
    component.addMouseListener(new MouseAdapter() {
        @Override//from ww w .jav  a 2 s .  com
        public void mousePressed(MouseEvent e) {
            if (e.isPopupTrigger()) {
                showMenu(e);
            }
        }

        @Override
        public void mouseReleased(MouseEvent e) {
            if (e.isPopupTrigger()) {
                showMenu(e);
            }
        }

        private void showMenu(MouseEvent e) {
            menu.show(e.getComponent(), e.getX(), e.getY());
        }
    });
}

From source file:org.broad.igv.ui.panel.PanTool.java

@Override
public void mousePressed(final MouseEvent e) {

    if (e.isPopupTrigger()) {
        return;/*from w  w w  .ja va  2s .  co  m*/
    }

    lastMousePoint = e.getPoint();
    cumulativeDeltaX = 0;
    cumulativeDeltaY = 0;

}

From source file:org.broad.igv.variant.VariantTrack.java

/**
 * Handle a mouse click from the name panel.
 *
 * @param e//ww  w .j ava 2  s .  c  o  m
 */
@Override
public void handleNameClick(MouseEvent e) {
    String sampleAtPosition = getSampleAtPosition(e.getY());

    if (e.isPopupTrigger()) {
        return;
    }

    if (e.isMetaDown() || e.isControlDown()) {
        if (sampleAtPosition != null) {
            if (selectedSamples.contains(sampleAtPosition)) {
                //    selectedSamples.remove(sampleAtPosition);
            } else {
                selectedSamples.add(sampleAtPosition);
            }
        }
    } else if (e.isShiftDown() && !selectedSamples.isEmpty()) {
        int idx = getSampleIndex(sampleAtPosition);
        int lastIDX = getSampleIndex(selectedSamples.get(selectedSamples.size() - 1));
        if (idx >= 0 && lastIDX >= 0) {
            selectedSamples.clear();
            for (int i = Math.min(idx, lastIDX); i <= (Math.max(idx, lastIDX)); i++) {
                String s = sampleBounds.get(i).sample;
                selectedSamples.add(s);
            }
        }

    } else {
        if (sampleAtPosition != null) {
            if (selectedSamples.size() == 1 && selectedSamples.contains(sampleAtPosition)) {
                selectedSamples.clear();
                IGV.getInstance().repaint();
                return;
            } else {
                selectedSamples.clear();
            }
            selectedSamples.add(sampleAtPosition);
        }
    }
    IGV.getInstance().repaint();

}

From source file:org.esa.nest.dat.views.polarview.PolarView.java

private void checkPopup(MouseEvent e) {
    if (e.isPopupTrigger()) {
        createPopupMenu(e);
    }
}