Example usage for java.awt.event MouseEvent getPoint

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

Introduction

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

Prototype

public Point getPoint() 

Source Link

Document

Returns the x,y position of the event relative to the source component.

Usage

From source file:com.db2eshop.gui.component.tab.SupplierTab.java

/**
 * <p>registerMouseListener.</p>
 *
 * @param jScrollPane a {@link javax.swing.JScrollPane} object.
 * @param table a {@link com.db2eshop.gui.component.table.api.GenericTable} object.
 *//*ww  w.  ja  v a 2  s.c  o m*/
public void registerMouseListener(JScrollPane jScrollPane, GenericTable<?> table) {
    jScrollPane.addMouseListener(new BaseMouseListener() {
        @Override
        public void mouseClicked(MouseEvent arg0) {
            if (arg0.getButton() == MouseEvent.BUTTON3) {
                tabRightClickPopupMenu.showMenu(arg0.getPoint(), null, null, supplierTable);
            }
        }
    });
}

From source file:uk.co.modularaudio.util.audio.gui.patternsequencer.PatternSequenceAmpGridMouseListener.java

@Override
public void mousePressed(final MouseEvent e) {
    //      log.debug("Mouse pressed");
    final Point clickPoint = e.getPoint();
    processMouseClickAtPosition(clickPoint);
}

From source file:cgpanalyser.gui.chart.XYMouseMarker.java

private Double getXPosition(MouseEvent e) {
    Rectangle2D plotArea = panel.getScreenDataArea();
    return plot.getDomainAxis().java2DToValue(e.getPoint().getX(), plotArea, plot.getDomainAxisEdge());
}

From source file:org.jcurl.mr.exp.gui.MouseSketchPanel.java

public MouseSketchPanel(final char hotKey) {
    this.hotKey = hotKey;
    addMouseMotionListener(new MouseMotionAdapter() {
        public void mouseMoved(MouseEvent e) {
            if (isHot)
                lineTo(e.getPoint());
        }//from   w  ww  .ja v a2 s .co  m
    });
    addKeyListener(this);
}

From source file:peakmlviewer.dialog.timeseries.EditableChart.java

public void mousePressed(MouseEvent event) {
    Point p = event.getPoint();
    entity = (CategoryItemEntity) panel.getEntityForPoint(p.x, p.y);
    if (entity != null)
        prevpoint = p;/*from   w  w  w .  ja va2 s.  co  m*/
}

From source file:ru.codemine.pos.ui.windows.document.startbalances.StartBalancesListWindow.java

@Override
public void setupActionListeners() {
    setNewActionListener(newSb);/*ww  w. j ava 2 s . c  o  m*/
    setEditActionListener(editSb);
    setDeleteActionListener(deleteSb);
    setProcessActionListener(processSb);
    setUnprocessActionListener(unprocessSb);
    setRefreshActionListener(refreshSbList);

    storeChooseBox.addActionListener(changeStoreSb);

    table.addMouseListener(new MouseAdapter() {
        @Override
        public void mousePressed(MouseEvent e) {
            Point p = e.getPoint();
            int row = table.rowAtPoint(p);
            if (e.getClickCount() == 2 && e.getButton() == MouseEvent.BUTTON1) {
                menuItemEdit.doClick();
            }
        }
    });

    actionListenersInit = true;
}

From source file:components.GlassPaneDemo.java

private void redispatchMouseEvent(MouseEvent e, boolean repaint) {
    Point glassPanePoint = e.getPoint();
    Container container = contentPane;
    Point containerPoint = SwingUtilities.convertPoint(glassPane, glassPanePoint, contentPane);
    if (containerPoint.y < 0) { //we're not in the content pane
        if (containerPoint.y + menuBar.getHeight() >= 0) {
            //The mouse event is over the menu bar.
            //Could handle specially.
        } else {/*from  www.jav a 2 s.co m*/
            //The mouse event is over non-system window 
            //decorations, such as the ones provided by
            //the Java look and feel.
            //Could handle specially.
        }
    } else {
        //The mouse event is probably over the content pane.
        //Find out exactly which component it's over.  
        Component component = SwingUtilities.getDeepestComponentAt(container, containerPoint.x,
                containerPoint.y);

        if ((component != null) && (component.equals(liveButton))) {
            //Forward events over the check box.
            Point componentPoint = SwingUtilities.convertPoint(glassPane, glassPanePoint, component);
            component.dispatchEvent(new MouseEvent(component, e.getID(), e.getWhen(), e.getModifiers(),
                    componentPoint.x, componentPoint.y, e.getClickCount(), e.isPopupTrigger()));
        }
    }

    //Update the glass pane if requested.
    if (repaint) {
        glassPane.setPoint(glassPanePoint);
        glassPane.repaint();
    }
}

From source file:org.jcurl.mr.gui.MouseSketchPanel.java

public MouseSketchPanel(final char hotKey) {
    this.hotKey = hotKey;
    addMouseMotionListener(new MouseMotionAdapter() {
        @Override/*w w  w  . ja  va2s . c om*/
        public void mouseMoved(final MouseEvent e) {
            if (isHot)
                MouseSketchPanel.this.lineTo(e.getPoint());
        }
    });
    addKeyListener(this);
}

From source file:Main.java

@Override
protected void processMouseEvent(MouseEvent e, JLayer<? extends JTabbedPane> l) {
    if (e.getID() != MouseEvent.MOUSE_CLICKED) {
        return;//from  www. ja va  2s .co  m
    }
    pt.setLocation(e.getPoint());
    JTabbedPane tabbedPane = (JTabbedPane) l.getView();
    int index = tabbedPane.indexAtLocation(pt.x, pt.y);
    if (index >= 0) {
        Rectangle rect = tabbedPane.getBoundsAt(index);
        Dimension d = button.getPreferredSize();
        int x = rect.x + rect.width - d.width - 2;
        int y = rect.y + (rect.height - d.height) / 2;
        Rectangle r = new Rectangle(x, y, d.width, d.height);
        if (r.contains(pt)) {
            tabbedPane.removeTabAt(index);
        }
    }
    l.getView().repaint();
}

From source file:com.original.widget.OPicture.java

public void mouseMoved(MouseEvent e) {
    Point pt = e.getPoint();
    Rectangle btnRect = getUI().getBtnRect();
    if (btnRect.contains(pt))
        this.model.setMouseOverBtn(true);
    //_mouseOverBtn = true;
    else/*from w w  w. j  av a 2 s.co  m*/
        //_mouseOverBtn = false;
        this.model.setMouseOverBtn(false);
    this.repaint();
}