Java 8 MouseListener - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 MouseListener class.

This code example shows how to use the following methods:mouseClicked, mouseReleased
This code example shows how to use the following methods:mouseEntered
    public void mouseEntered(MouseEvent e) {
        clickCount = 0;
        lastTime = 0;
        lastPeer = null; 
 
        listener.mouseEntered(e);
    } 
 
    public void mouseExited(MouseEvent e) {
        clickCount = 0;
        lastTime = 0;
        lastPeer = null; 
 
        listener.mouseExited(e);
    } 
 
    public void mousePressed(MouseEvent e) {
        int x;
        int y;
 
4
CodeRank
This code example shows how to use the following methods:mousePressed
        public void mousePressed(MouseEvent e) {
            if (((CollapsiblePanel)e.getSource()).isArmPoint(e.getPoint())) {
                ((CollapsiblePanel)e.getSource()).setExpanded(!((CollapsiblePanel)e.getSource()).isExpanded());
                e.consume();
            } else if (secondaryListener != null) {
                secondaryListener.mousePressed(e);
            } 
        } 
 
        @Override 
        public void mouseDragged(MouseEvent e) {
            // do nothing 
        } 
    } 
 
    private class UpIcon implements Icon {
        @Override 
        public int getIconHeight () { 
            return ICON_SIZE - 2;
        } 
3
CodeRank
This code example shows how to use the following methods:mouseClicked
        MouseListener[] mouseListeners = twistie.getMouseListeners();
        Assert.assertNotNull(mouseListeners);
        Assert.assertEquals(mouseListeners.length, 1);
        MouseListener mouseListener = mouseListeners[0];
        mouseEvent = Mockito.mock(MouseEvent.class);
        mouseListener.mouseClicked(mouseEvent);
        checkState(twistie, true);
        Assert.assertEquals(invocationCt, 1);
    } 
     
    @Test(dependsOnMethods = {"testClick"})
    public void testMethod() throws Exception {
        twistie.changeState(false);
        checkState(twistie, false);
        Assert.assertEquals(invocationCt, 0);
    } 
 
     
    private void checkState(Twistie twistie, boolean expectedValue) {
        try { 
3
CodeRank
This code example shows how to use the following methods:mouseEntered
        listener.mouseReleased(translateToGrid(e));
    } 
 
    @Override 
    public void mouseEntered(MouseEvent e) {
        listener.mouseEntered(translateToGrid(e));
    } 
 
    @Override 
    public void mouseExited(MouseEvent e) {
        listener.mouseExited(translateToGrid(e));
    } 
 
    @Override 
    public void mouseDragged(MouseEvent e) {
        listener.mouseDragged(translateToGrid(e));
    } 
 
    @Override 
    public void mouseMoved(MouseEvent e) {
4
CodeRank
This code example shows how to use the following methods:mousePressed
        } 
    } 
     
    public void mousePressed(LayerEvent e) {
        if(_filter.accept(e)) {
            _ml.mousePressed(e);
        } 
    } 
 
    public void mouseDragged(LayerEvent e) {
        if(_filter.accept(e)) {
            _mml.mouseDragged(e);
        } 
    } 
 
    public void mouseMoved(LayerEvent e) {
        if(_filter.accept(e)) {
            _mml.mouseMoved(e);
        } 
    } 
4
CodeRank
This code example shows how to use the following methods:mouseClicked
    public void mouseClicked(MouseEvent e) {
        if (e.isPopupTrigger()) {                
            return; 
        } 
         
        mouseListener.mouseClicked(e);
    } 
 
    @Override 
    public void mouseEntered(MouseEvent e) {
        mouseListener.mouseEntered(e);
    } 
 
    @Override 
    public void mouseExited(MouseEvent e) {
        mouseListener.mouseExited(e);
    } 
 
    @Override 
    public void mousePressed(MouseEvent e) {
4
CodeRank
This code example shows how to use the following methods:mousePressed
        } 
    } 
 
    public void mousePressed(MouseEvent e) {
        if (_listener != null) {
            _listener.mousePressed(e);
        } 
    } 
 
    public void mouseReleased(MouseEvent e) {
        if (_listener != null) {
            _listener.mouseReleased(e);
        } 
    } 
 
    public void mouseEntered(MouseEvent e) {
        if (_listener != null) {
            _listener.mouseEntered(e);
        } 
    } 
4
CodeRank
This code example shows how to use the following methods:mouseClicked
        _listener = listener;
    } 
 
    public void mouseClicked(MouseEvent e) {
        if (_listener != null) {
            _listener.mouseClicked(e);
        } 
    } 
 
    public void mousePressed(MouseEvent e) {
        if (_listener != null) {
            _listener.mousePressed(e);
        } 
    } 
 
    public void mouseReleased(MouseEvent e) {
        if (_listener != null) {
            _listener.mouseReleased(e);
        } 
    } 
4
CodeRank
See Code Examples for Java 8 MouseListener Methods: