Java Code Examples for javax.swing.event.MenuDragMouseEvent#getMenuSelectionManager()

The following examples show how to use javax.swing.event.MenuDragMouseEvent#getMenuSelectionManager() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MouseEventAdapter.java    From consulo with Apache License 2.0 5 votes vote down vote up
public static MenuDragMouseEvent convert(MenuDragMouseEvent event, Component source, int id, long when, int modifiers, int x, int y) {
  return new MenuDragMouseEvent(source, id, when, modifiers, x, y,
                                event.getClickCount(),
                                event.isPopupTrigger(),
                                event.getPath(),
                                event.getMenuSelectionManager());
}
 
Example 2
Source File: BegMenuItemUI.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void menuDragMouseReleased(MenuDragMouseEvent e) {
  MenuSelectionManager manager = e.getMenuSelectionManager();
  Point p = e.getPoint();
  if (p.x >= 0 && p.x < menuItem.getWidth() &&
      p.y >= 0 && p.y < menuItem.getHeight()) {
    doClick(manager, e);
  }
  else {
    manager.clearSelectedPath();
  }
}
 
Example 3
Source File: ModernMenuItemUI.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void menuDragMouseReleased(MenuDragMouseEvent e) {
  MenuSelectionManager manager = e.getMenuSelectionManager();
  Point p = e.getPoint();
  if (p.x >= 0 && p.x < menuItem.getWidth() &&
      p.y >= 0 && p.y < menuItem.getHeight()) {
    doClick(manager, e);
  }
  else {
    manager.clearSelectedPath();
  }
}
 
Example 4
Source File: BegMenuItemUI.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public void menuDragMouseDragged(MenuDragMouseEvent e) {
  MenuSelectionManager manager = e.getMenuSelectionManager();
  MenuElement path[] = e.getPath();
  manager.setSelectedPath(path);
}
 
Example 5
Source File: ModernMenuItemUI.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public void menuDragMouseDragged(MenuDragMouseEvent e) {
  MenuSelectionManager manager = e.getMenuSelectionManager();
  MenuElement path[] = e.getPath();
  manager.setSelectedPath(path);
}