Package java.awt.event

Examples of java.awt.event.MouseEvent


      return null;
    } else {
      canvas = event.getCanvas();
      CircuitState circState = event.getCircuitState();
      InstanceStateImpl state = new InstanceStateImpl(circState, comp);
      MouseEvent e = new MouseEvent(event.getCanvas(),
          MouseEvent.MOUSE_PRESSED, System.currentTimeMillis(), 0,
          event.getX(), event.getY(), 1, false);
      boolean isAccepted = poker.init(state, e);
      if (isAccepted) {
        this.state = state;
View Full Code Here


  protected void dispatchEvent(AWTEvent event) {
    // stop auto scrolling on any mouse event
    try {
      if (event instanceof MouseEvent) {
        MouseEvent me = (MouseEvent) event;
        if (me.getButton() != MouseEvent.NOBUTTON && me.getID() == MouseEvent.MOUSE_CLICKED) {
          if (MainFrame.getInstance().getProgramTableScrollPane().getProgramTable().stopAutoScroll()) {
            return;
          }
        }
      }
    } catch (Exception e1) {
      // TODO Auto-generated catch block
      // e1.printStackTrace();
    }
   
    try {
      super.dispatchEvent(event);
    }catch(Throwable e) {
      // e.printStackTrace();
      return;}

    // interested only in mouseevents
    if (!(event instanceof MouseEvent)) {
      return;
    }

    MouseEvent me = (MouseEvent) event;
   
    // interested only in popuptriggers
    if (!me.isPopupTrigger() || me.getComponent() == null) {
      return;
    }

    // me.getComponent(...) returns the heavy weight component on which event
    // occured
    Component comp = SwingUtilities.getDeepestComponentAt(me.getComponent(), me.getX(), me.getY());

    // interested only in textcomponents
    if (!(comp instanceof JTextComponent)) {
      return;
    }

    // no popup shown by user code
    if (MenuSelectionManager.defaultManager().getSelectedPath().length > 0) {
      return;
    }

    // create popup menu and show
    JTextComponent tc = (JTextComponent) comp;
    JPopupMenu menu = new JPopupMenu();
    addStandardContextMenu(tc, menu);

    Point pt = SwingUtilities
        .convertPoint(me.getComponent(), me.getPoint(), tc);
    menu.show(tc, pt.x, pt.y);
  }
View Full Code Here

            c.actionPerformed(new ActionEvent(this, 0, "console"));
            assertContains(lastUrl, ":9002");
            lastUrl = "-";
            // double-click prevention is 100 ms
            Thread.sleep(200);
            MouseEvent me = new MouseEvent(new Button(), 0, 0, 0, 0, 0, 0, false, MouseEvent.BUTTON1);
            c.mouseClicked(me);
            assertContains(lastUrl, ":9002");
            lastUrl = "-";
            // no delay - ignore because it looks like a double click
            c.mouseClicked(me);
View Full Code Here

  /**
   * Show the popup menu
   * @param event The GUIEvent which documents the mouse right-click action
   */
  public void popup(GUIEvent event) {
    MouseEvent mouseEvent = (MouseEvent) event.getSwingEvent();
    popupMenu.show(((Widget)event.getSource()).getRealWidget(), mouseEvent.getX(), mouseEvent.getY());
  }
View Full Code Here

        }

        if (event.shouldShowGUI() && isMask(ALT_POPUP_BEHAVIOR_MASK)) {
            if (DEBUG)
                Debug.output("OMDrawingTool.eomgChanged(): try for menu.");
            MouseEvent me = event.getMouseEvent();

            // While we're here, get a good place for the window in
            // case we need to put it up later.
            if (currentEditable != null) {

                currentEditable.getStateMachine().setSelected();
                currentEditable.redraw(me, true);

                Shape ces = currentEditable.getGraphic().getShape();
                if (ces != null) {
                    Rectangle rect = ces.getBounds();
                    windowx = (int) rect.getX();
                    windowy = (int) rect.getY() - 50;
                }
            }

            /**
             * Let's see if we should bring up pop-up menu with all sorts of
             * lovely options - if the right mouse key was pressed, or if the
             * ctrl key was pressed with the mouse button being released,
             * display the option menu. Otherwise, just get ready to end.
             */
            doPopup(me.getX(), me.getY(), null);
        } else if (event.shouldDeactivate()) {
            if (DEBUG) {
                Debug.output("OMDrawingTool.eomgChanged(): omdt being told to deactivate");
            }

View Full Code Here

                dt.setMask(OMDrawingTool.PASSIVE_MOUSE_EVENT_BEHAVIOR_MASK);
            }

            MapMouseInterpreter mmi = (MapMouseInterpreter) getMapMouseListener();

            MouseEvent mevent = null;
            if (mmi != null) {
                mevent = mmi.getCurrentMouseEvent();
            }

            if (omg.isSelected()) {
View Full Code Here

    }

    if (context==MOUSE_PRESSED_CONTEXT) {
      // Only monitor when selecting
      if (!selecting) return null;
      MouseEvent e = (MouseEvent)o;
      if ((e.getModifiers() & MouseEvent.BUTTON1_MASK) == MouseEvent.BUTTON1_MASK)
        return new String[] {"leftClick"};
      if ((e.getModifiers() & MouseEvent.BUTTON3_MASK) == MouseEvent.BUTTON3_MASK) {
        return new String[] {"rightClick"};
      }
      return null;
    }
View Full Code Here

          if (fireCloseTab(selIndex)) {
            if (selIndex > 0) {
              // to prevent uncatchable null-pointers
              Rectangle rec = getUI().getTabBounds(this, selIndex - 1);

              MouseEvent event = new MouseEvent((Component) e.getSource(),
                                                e.getID() + 1,
                                                System.currentTimeMillis(),
                                                e.getModifiers(),
                                                rec.x,
                                                rec.y,
View Full Code Here

        if (context==MOUSE_OUT_CONTEXT) {
            return new String[] {"mouseOut"};
        }
       
        if (context==MOUSE_PRESSED_CONTEXT) {
            MouseEvent e = (MouseEvent)o;
            // Monitor left click
            if ((e.getModifiers() & MouseEvent.BUTTON1_MASK) != MouseEvent.BUTTON1_MASK)
                return null;
            return null;
        }

        Vector v = new Vector();
View Full Code Here

            SunDropTargetEvent sdde = (SunDropTargetEvent) e;
            ret = processDropTargetEvent(sdde);

        } else {
            if (e instanceof MouseEvent && (eventMask & MOUSE_MASK) != 0) {
                MouseEvent me = (MouseEvent) e;
                ret = processMouseEvent(me);
            }

            if (e.getID() == MouseEvent.MOUSE_MOVED) {
                nativeContainer.updateCursorImmediately();
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.