Пример #1
0
  protected void itemMouseEvent(MouseEvent e, Point tempPt) {
    mouseInside = false;
    visibleMouseEvent(e, tempPt);
    if (isOpen()) {
      for (int i = zSortedItems.size() - 1; i >= 0; i--) {
        MenuItem item = (MenuItem) zSortedItems.get(i);
        if (e.isConsumed()) continue;
        item.itemMouseEvent(e, tempPt);
        if (item.mouseInside) mouseInside = true;
      }
    }
    if (mouseInside && getZ() == 0) {
      setZ(1);
      if (parent != null) parent.needsZSort = true;
    } else if (!mouseInside && getZ() == 1) {
      setZ(0);
      if (parent != null) parent.needsZSort = true;
    }

    /*
     * If the mouse is inside but we're disabled, we want to not show the hand cursor.
     */
    if (mouseInside && !isEnabled()) {
      menu.setCursor(Cursor.DEFAULT_CURSOR);
    }
  }
Пример #2
0
 protected void itemMouseEvent(MouseEvent e, Point pt) {
   /*
    * I'm doing this actionOnMouseDown stuff so that the top-level menus
    * are activated on a mouse press, to be more toolbar-like (I'm looking
    * to match Eclipse-like functionality). Basically, I'm overriding the
    * default values if we're in a top-level menu.
    */
   super.itemMouseEvent(e, pt);
   // if (parent == menu && mouseInside)
   // {
   // if (e.getID() == MouseEvent.MOUSE_RELEASED)
   // {
   // if (!isOpen())
   // {
   // menuTriggerLogic();
   // } else
   // {
   // close();
   // }
   // }
   // // System.out.println("Hey!");
   // }
 }