Package java.awt.event

Examples of java.awt.event.MouseEvent


                    hoverTimer.cancel();
                }
               
                // If there is a currently hovering entity, then send a stop
                // event
                MouseEvent mouseEvent = (MouseEvent) ((MouseEvent3D) event).getAwtEvent();
                if (hoverEntity != null) {
                    inputManager.postEvent(new HoverEvent(hoverEntity, false, mouseEvent));
                    hoverEntity = null;
                }
               
                // Update the hover start time. This will cause any remaining
                // timer tasks that may have been run to ignore themselves
                hoverStartTime = System.currentTimeMillis();
               
                // Launch a new timer task, but not unless we are actually over
                // a non-null entity
                if (entity != null) {
                    HoverTimerTask task = new HoverTimerTask(entity, hoverStartTime, mouseEvent);
                    hoverTimer = new Timer();
                    hoverTimer.schedule(task, policy.getHoverDelay());
                }
            }
        }
       
        if (policy.isClearedSelection(event) == true) {
            // If we wish to clear the selection, then simply clear out the
            // list and fire an event
            selectedEntityList.clear();
            inputManager.postEvent(new SelectionEvent(new LinkedList(selectedEntityList)));
            return;
        }
        else if (policy.isSingleSelection(event) == true) {
            // issue #1115: ignore the event if it is selecting an object that
            // is already selected
            if (selectedEntityList.contains(entity) == true) {
                // OWL issue #177: send an empty context event to ensure that
                // any visible context menus are hidden in this case
                MouseEvent mouseEvent = (MouseEvent) ((MouseEvent3D) event).getAwtEvent();
                inputManager.postEvent(new ContextEvent(new LinkedList(), mouseEvent));
               
                return;
            }

            // Clear out the list, add the new Entity and fire an event
            selectedEntityList.clear();
            selectedEntityList.add(entity);
            inputManager.postEvent(new SelectionEvent(new LinkedList(selectedEntityList)));
            return;
        }
        else if (policy.isMultiSelection(event) == true) {
            // If the Entity is already selected, then remove it from the
            // selection list. If not already present, then add it
            // Reset the selection possible. If the entity is not selected,
            // then select it (only). If the entity is selected, then do
            // nothing (if it is part of a group of selected entities)
            if (selectedEntityList.contains(entity) == false) {
                selectedEntityList.add(entity);
            }
            else {
                selectedEntityList.remove(entity);
            }
            inputManager.postEvent(new SelectionEvent(new LinkedList(selectedEntityList)));
            return;
        }
        else if (policy.isEnter(event) == true) {
            enterEntity = entity;
            inputManager.postEvent(new EnterExitEvent(entity, true));
        }
        else if (policy.isExit(event) == true) {
            Entity eventEntity = enterEntity;
            enterEntity = null;
            inputManager.postEvent(new EnterExitEvent(eventEntity, false));
        }
        else if (policy.isActivation(event) == true) {
            inputManager.postEvent(new ActivatedEvent(entity));
        }
        else if (policy.isContext(event) == true) {
            // We use the context event to clear the selected entity list first
            selectedEntityList.clear();

            // If there is an entity for the mouse event, then add the entity to
            // the list and pass a Selection event too.
            if (entity != null) {
                selectedEntityList.add(entity);
                LinkedList entityList = new LinkedList(selectedEntityList);
                inputManager.postEvent(new SelectionEvent(entityList));
            }

            // Pass the mouse event for now so we know where the event was
            // fired. We sent this even if the entity is null, so the context
            // menu can be cleared.
            LinkedList entityList = new LinkedList(selectedEntityList);
            MouseEvent mouseEvent = (MouseEvent) ((MouseEvent3D) event).getAwtEvent();
            inputManager.postEvent(new ContextEvent(entityList, mouseEvent));
        }
    }
View Full Code Here


                    hoverTimer.cancel();
                }

                // If there is a currently hovering entity, then send a stop
                // event
                MouseEvent mouseEvent = (MouseEvent) ((HoverEvent) event).getMouseEvent();
                if (hoverEntity != null) {
                    inputManager.postEvent(new HoverEvent(hoverEntity, false, mouseEvent));
                    hoverEntity = null;
                }

                // Update the hover start time. This will cause any remaining
                // timer tasks that may have been run to ignore themselves
                hoverStartTime = System.currentTimeMillis();

                // Launch a new timer task, but not unless we are actually over
                // a non-null entity
                if (entity != null) {
                    HoverTimerTask task = new HoverTimerTask(entity, hoverStartTime, mouseEvent);
                    hoverTimer = new Timer();
                    hoverTimer.schedule(task, policy.getHoverDelay());
                }
            }
        }

        // If a selection event, then set the list of entities and re-post the
        // event.
        if (event instanceof SelectionEvent) {
            // If a selection event, then set the list of entities and re-port
            // the event
            selectedEntityList.clear();
            selectedEntityList.addAll(event.getEntityList());
            inputManager.postEvent(new SelectionEvent(new LinkedList(selectedEntityList)));
            return;
        }

        // If an enter/exit event, then note the Entity we are entering or
        // exiting and repost the event.
        if (event instanceof EnterExitEvent) {
            if (((EnterExitEvent)event).isEnter() == true) {
                enterEntity = entity;
                inputManager.postEvent(new EnterExitEvent(entity, true));
            }
            else {
                Entity eventEntity = enterEntity;
                enterEntity = null;
                inputManager.postEvent(new EnterExitEvent(eventEntity, false));
            }
            return;
        }

        // If an activation event, the simply repost the event
        if (event instanceof ActivatedEvent) {
            inputManager.postEvent(new ActivatedEvent(entity));
            return;
        }

        // If a context event, then set the list of entities associated with
        // the context and re-post the event.
        if (event instanceof ContextEvent) {
            Logger.getLogger(SceneManager.class.getName()).warning("RECEIVED CONTEXT EVENT " +
                    entity.getName());
            // We use the context event to clear the selected entity list first
            selectedEntityList.clear();

            // If there is an entity for the mouse event, then add the entity to
            // the list and pass a Selection event too.
            if (entity != null) {
                selectedEntityList.add(entity);
                LinkedList entityList = new LinkedList(selectedEntityList);
                inputManager.postEvent(new SelectionEvent(entityList));
            }

            // Pass the mouse event for now so we know where the event was
            // fired. We sent this even if the entity is null, so the context
            // menu can be cleared.
            LinkedList entityList = new LinkedList(selectedEntityList);
            MouseEvent mouseEvent = (MouseEvent) ((ContextEvent) event).getMouseEvent();
            inputManager.postEvent(event);
            return;
        }
    }
View Full Code Here

                    while (it.hasNext()) {
                        Object next = it.next();
                        if (next instanceof MouseDraggedRunnable) {
                            MouseDraggedRunnable mdr;
                            mdr = (MouseDraggedRunnable)next;
                            MouseEvent mev = mdr.event;
                            if (mev.getModifiers() == e.getModifiers()) {
                                mdr.event = e;
                            }
                            return;
                        }
                    }
View Full Code Here

                    while (it.hasNext()) {
                        Object next = it.next();
                        if (next instanceof MouseMovedRunnable) {
                            MouseMovedRunnable mmr;
                            mmr = (MouseMovedRunnable)next;
                            MouseEvent mev = mmr.event;
                            if (mev.getModifiers() == e.getModifiers()) {
                                mmr.event = e;
                            }
                            return;
                        }
                        i++;
View Full Code Here

            EventQueue.invokeLater(new Runnable() {
                    public void run() {
                        setToolTipText(toolTip);

                        if (toolTip != null) {
                            MouseEvent e = new MouseEvent
                                (JSVGCanvas.this,
                                 MouseEvent.MOUSE_ENTERED,
                                 System.currentTimeMillis(),
                                 0,
                                 locationListener.getLastX(),
View Full Code Here

                    while (it.hasNext()) {
                        Object next = it.next();
                        if (next instanceof MouseDraggedRunnable) {
                            MouseDraggedRunnable mdr;
                            mdr = (MouseDraggedRunnable)next;
                            MouseEvent mev = mdr.event;
                            if (mev.getModifiers() == e.getModifiers()) {
                                mdr.event = e;
                            }
                            return;
                        }
                    }
View Full Code Here

                    while (it.hasNext()) {
                        Object next = it.next();
                        if (next instanceof MouseMovedRunnable) {
                            MouseMovedRunnable mmr;
                            mmr = (MouseMovedRunnable)next;
                            MouseEvent mev = mmr.event;
                            if (mev.getModifiers() == e.getModifiers()) {
                                mmr.event = e;
                            }
                            return;
                        }
                        i++;
View Full Code Here

    // evm (touchscreen) events: entered/moved/pressed -> dragged -> dragged/released/exited
    int id = e.getID();
    if ((id == MouseEvent.MOUSE_ENTERED) || (id == MouseEvent.MOUSE_MOVED) ||
        (id == MouseEvent.MOUSE_EXITED) || (id == MouseEvent.MOUSE_PRESSED) ||
        (id == MouseEvent.MOUSE_DRAGGED) || (id == MouseEvent.MOUSE_RELEASED)) {
      MouseEvent me = (MouseEvent) e;
      int x = me.getX();
      int y = me.getY();
      int clickcount = me.getClickCount();
      boolean shiftdown = me.isShiftDown();
      boolean controldown = me.isControlDown();
      boolean popuptrigger = me.isPopupTrigger();
      if (id == MouseEvent.MOUSE_ENTERED) {
        if (mousepressed == null) {
          findComponent(content, x, y);
          handleMouseEvent(x, y, clickcount, shiftdown, controldown, popuptrigger,
            MouseEvent.MOUSE_ENTERED, mouseinside, insidepart);
View Full Code Here

        final boolean popupTrigger = (button == MouseEvent.BUTTON2);

        final int ex = x - p.x; // - pwo.x;
        final int ey = y - p.y; // - pwo.y;
        final int modifiers = getModifiers();
        MouseEvent event;
        if (id == MouseEvent.MOUSE_WHEEL) {
            event = new MouseWheelEvent(source, id, time, modifiers, ex, ey,
                1, popupTrigger, MouseWheelEvent.WHEEL_UNIT_SCROLL,
                wheelAmt, //TODO check what to put here
                wheelAmt); //TODO check what to put here
        } else {
            event = new MouseEvent(source, id, time, modifiers, ex, ey,
                clickCount, popupTrigger, button);
            if (id == MouseEvent.MOUSE_PRESSED) {
                ((JNodeToolkit) Toolkit.getDefaultToolkit()).activateWindow(source);
            }
        }
View Full Code Here

        final int ex = x - p.x; // - pwo.x;
        final int ey = y - p.y; // - pwo.y;
        final int modifiers = getModifiers();

        final MouseEvent event = new MouseEvent(source, id, time, modifiers, ex, ey,
            clickCount, popupTrigger, button);

        eventQueue.postEvent(event);
    }
View Full Code Here

TOP

Related Classes of java.awt.event.MouseEvent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.