Example usage for java.awt.event MouseEvent getY

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

Introduction

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

Prototype

public int getY() 

Source Link

Document

Returns the vertical y position of the event relative to the source component.

Usage

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

private void lstProducersMouseReleased(java.awt.event.MouseEvent evt) {
    if (evt.isPopupTrigger()) {
        JPopupMenu menu = depositPresenter.getProducerMenu();
        if (menu != null) {
            menu.show(evt.getComponent(), evt.getX(), evt.getY());
        }/* w w w  .j a  v  a  2 s  .c om*/
    }
}

From source file:com.actelion.research.table.view.JVisualization.java

@Override
public Point getToolTipLocation(MouseEvent e) {
    VisualizationPoint vp = findMarker(e.getX(), e.getY());
    return (vp != null) ? new Point(vp.screenX, vp.screenY) : null;
}

From source file:com.actelion.research.table.view.JVisualization.java

public void mouseMoved(MouseEvent e) {
    VisualizationPoint marker = findMarker(e.getX(), e.getY());
    if (mHighlightedPoint != marker)
        mTableModel.setHighlightedRow((marker == null) ? null : marker.record);
}

From source file:com.actelion.research.table.view.JVisualization.java

public void mouseDragged(MouseEvent e) {
    mMouseX2 = e.getX();/* ww  w.j a v a  2  s. c  o m*/
    mMouseY2 = e.getY();

    if (mRectangleSelecting) {
        repaint();
    } else if (mLassoSelecting) {
        if ((Math.abs(mMouseX2 - mLassoRegion.xpoints[mLassoRegion.npoints - 1]) > 3)
                || (Math.abs(mMouseY2 - mLassoRegion.ypoints[mLassoRegion.npoints - 1]) > 3)) {
            mLassoRegion.npoints--;
            mLassoRegion.addPoint(mMouseX2, mMouseY2);
            mLassoRegion.addPoint(mMouseX1, mMouseY1);
        }

        repaint();
    }
}

From source file:com.actelion.research.table.view.JVisualization.java

@Override
public String getToolTipText(MouseEvent e) {
    VisualizationPoint vp = findMarker(e.getX(), e.getY());
    if (vp == null)
        return null;
    StringBuilder sb = new StringBuilder();
    for (int axis = 0; axis < mDimensions; axis++)
        addTooltipRow(vp.record, mAxisIndex[axis], mAxisSimilarity[axis], sb);

    addMarkerTooltips(vp, sb);/*from   w  w w  .j  av  a 2s . c om*/

    sb.append("</html>");
    return sb.toString();
}

From source file:edu.ku.brc.ui.tmanfe.SpreadSheet.java

@Override
public void processMouseEvent(MouseEvent ev) {
    int type = ev.getID();
    //int modifiers = ev.getModifiers();

    mouseDown = type == MouseEvent.MOUSE_PRESSED;

    // XXX For Java 5 Bug
    // I am not sure if we still need this
    if (mouseDown && UIHelper.getOSType() == UIHelper.OSTYPE.MacOSX) {
        int rowIndexStart = rowAtPoint(ev.getPoint());
        int colIndexStart = columnAtPoint(ev.getPoint());

        //System.out.println(isEditing()+"  "+rowIndexStart+" "+colIndexStart+" "+prevRowSelInx+" "+prevColSelInx+" ");
        if (isEditing() && (prevRowSelInx != rowIndexStart || prevColSelInx != colIndexStart)) {
            getCellEditor().stopCellEditing();
        }//  www .ja  va  2 s .com
    }
    // Done - For Java 5 Bug

    if (ev.isPopupTrigger()) {
        // No matter what, stop editing if we are editing
        if (isEditing()) {
            getCellEditor().stopCellEditing();
        }

        // Now check to see if we right clicked on a different rowor column
        boolean isOnSelectedCell = false;
        int rowIndexStart = rowAtPoint(ev.getPoint());
        int colIndexStart = columnAtPoint(ev.getPoint());

        // Check to see if we are in the selection of mulitple rows and cols
        if (getSelectedRowCount() > 0) {
            int[] cols = getSelectedColumns();
            for (int r : getSelectedRows()) {
                if (r == rowIndexStart) {
                    for (int c : cols) {
                        if (c == colIndexStart) {
                            isOnSelectedCell = true;
                            break;
                        }
                    }
                }
            }
        }
        if (!isOnSelectedCell) {
            setRowSelectionInterval(rowIndexStart, rowIndexStart);
            setColumnSelectionInterval(colIndexStart, colIndexStart);
        }

        if (popupMenu != null) {
            popupMenu.setVisible(false);
        }

        popupMenu = createMenuForSelection(ev.getPoint());

        if (popupMenu.isVisible()) {
            popupMenu.setVisible(false);

        } else {
            //popupMenu.setTargetCells(_selection);
            Point p = getLocationOnScreen();
            popupMenu.setLocation(p.x + ev.getX() + 1, p.y + ev.getY() + 1);
            popupMenu.setVisible(true);
        }
    }
    super.processMouseEvent(ev);
}

From source file:com.mirth.connect.client.ui.ChannelSetup.java

/**
 * Shows the popup menu when the trigger button (right-click) has been pushed.
 */// ww  w .  j ava  2s.  c o m
private void checkSelectionAndPopupMenu(java.awt.event.MouseEvent evt) {
    int row = destinationTable.rowAtPoint(new Point(evt.getX(), evt.getY()));

    if (evt.isPopupTrigger()) {
        if (row != -1) {
            destinationTable.setRowSelectionInterval(row, row);
        }
        showChannelEditPopupMenu(evt);
    }
}

From source file:com.mirth.connect.client.ui.ChannelPanel.java

/**
 * Shows the popup menu when the trigger button (right-click) has been pushed. Deselects the
 * rows if no row was selected./*from   w  w  w.j  a  v a 2 s .com*/
 */
private void checkSelectionAndPopupMenu(MouseEvent evt) {
    int row = channelTable.rowAtPoint(new Point(evt.getX(), evt.getY()));
    if (row == -1) {
        deselectRows();
    }

    if (evt.isPopupTrigger()) {
        if (row != -1) {
            if (!channelTable.isRowSelected(row)) {
                channelTable.setRowSelectionInterval(row, row);
            }

            if (((AbstractChannelTableNode) channelTable.getPathForRow(row).getLastPathComponent())
                    .isGroupNode()) {
                groupPopupMenu.show(evt.getComponent(), evt.getX(), evt.getY());
            } else {
                channelPopupMenu.show(evt.getComponent(), evt.getX(), evt.getY());
            }
        } else {
            channelPopupMenu.show(evt.getComponent(), evt.getX(), evt.getY());
        }
    }
}

From source file:com.actelion.research.table.view.JVisualization.java

public void mousePressed(MouseEvent e) {
    mMouseX1 = mMouseX2 = e.getX();/* w w  w.j  ava  2  s . c o m*/
    mMouseY1 = mMouseY2 = e.getY();
    mMouseIsDown = true;

    if (System.getProperty("touch") != null) {
        new Thread() {
            public void run() {
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException ie) {
                }

                if (Math.abs(mMouseX2 - mMouseX1) < 5 && Math.abs(mMouseY2 - mMouseY1) < 5 && mMouseIsDown) {
                    SwingUtilities.invokeLater(new Runnable() {
                        public void run() {
                            activateTouchFunction();
                        }
                    });
                }
            }
        }.start();
    }

    mRectangleSelecting = false;
    mLassoSelecting = false;
    if (!handlePopupTrigger(e) && (e.getModifiers() & InputEvent.BUTTON3_MASK) == 0) {
        mAddingToSelection = e.isShiftDown();
        if (e.isAltDown())
            mRectangleSelecting = true;
        else {
            mLassoSelecting = true;
            mLassoRegion = new Polygon();
            mLassoRegion.addPoint(mMouseX1, mMouseY1);
            mLassoRegion.addPoint(mMouseX1, mMouseY1);
        }
    }
}

From source file:com.mirth.connect.client.ui.ChannelSetup.java

/**
 * Shows the trigger-button popup menu./*from  w  w w  .j  a v a2  s. c  o  m*/
 */
private void showChannelEditPopupMenu(java.awt.event.MouseEvent evt) {
    if (evt.isPopupTrigger()) {
        parent.channelEditPopupMenu.show(evt.getComponent(), evt.getX(), evt.getY());
    }
}