Java Code Examples for javax.swing.event.MenuDragMouseEvent

The following examples show how to use javax.swing.event.MenuDragMouseEvent. These examples are extracted from open source projects. 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 Project: dragonwell8_jdk   Source File: bug7170657.java    License: GNU General Public License v2.0 6 votes vote down vote up
public static void main(final String[] args) {
    final int mask = InputEvent.META_DOWN_MASK | InputEvent.CTRL_MASK;

    Frame f = new Frame();

    MouseEvent mwe = new MouseWheelEvent(f, 1, 1, mask, 1, 1, 1, 1, 1, true,
                                         1, 1, 1);
    MouseEvent mdme = new MenuDragMouseEvent(f, 1, 1, mask, 1, 1, 1, 1, 1,
                                             true, null, null);
    MouseEvent me = new MouseEvent(f, 1, 1, mask, 1, 1, 1, 1, 1, true,
                                   MouseEvent.NOBUTTON);

    test(f, mwe);
    test(f, mdme);
    test(f, me);

    if (FAILED) {
        throw new RuntimeException("Wrong mouse event");
    }
}
 
Example 2
Source Project: TencentKona-8   Source File: bug7170657.java    License: GNU General Public License v2.0 6 votes vote down vote up
public static void main(final String[] args) {
    final int mask = InputEvent.META_DOWN_MASK | InputEvent.CTRL_MASK;

    Frame f = new Frame();

    MouseEvent mwe = new MouseWheelEvent(f, 1, 1, mask, 1, 1, 1, 1, 1, true,
                                         1, 1, 1);
    MouseEvent mdme = new MenuDragMouseEvent(f, 1, 1, mask, 1, 1, 1, 1, 1,
                                             true, null, null);
    MouseEvent me = new MouseEvent(f, 1, 1, mask, 1, 1, 1, 1, 1, true,
                                   MouseEvent.NOBUTTON);

    test(f, mwe);
    test(f, mdme);
    test(f, me);

    if (FAILED) {
        throw new RuntimeException("Wrong mouse event");
    }
}
 
Example 3
Source Project: jdk8u60   Source File: bug7170657.java    License: GNU General Public License v2.0 6 votes vote down vote up
public static void main(final String[] args) {
    final int mask = InputEvent.META_DOWN_MASK | InputEvent.CTRL_MASK;

    Frame f = new Frame();

    MouseEvent mwe = new MouseWheelEvent(f, 1, 1, mask, 1, 1, 1, 1, 1, true,
                                         1, 1, 1);
    MouseEvent mdme = new MenuDragMouseEvent(f, 1, 1, mask, 1, 1, 1, 1, 1,
                                             true, null, null);
    MouseEvent me = new MouseEvent(f, 1, 1, mask, 1, 1, 1, 1, 1, true,
                                   MouseEvent.NOBUTTON);

    test(f, mwe);
    test(f, mdme);
    test(f, me);

    if (FAILED) {
        throw new RuntimeException("Wrong mouse event");
    }
}
 
Example 4
Source Project: openjdk-jdk8u   Source File: bug7170657.java    License: GNU General Public License v2.0 6 votes vote down vote up
public static void main(final String[] args) {
    final int mask = InputEvent.META_DOWN_MASK | InputEvent.CTRL_MASK;

    Frame f = new Frame();

    MouseEvent mwe = new MouseWheelEvent(f, 1, 1, mask, 1, 1, 1, 1, 1, true,
                                         1, 1, 1);
    MouseEvent mdme = new MenuDragMouseEvent(f, 1, 1, mask, 1, 1, 1, 1, 1,
                                             true, null, null);
    MouseEvent me = new MouseEvent(f, 1, 1, mask, 1, 1, 1, 1, 1, true,
                                   MouseEvent.NOBUTTON);

    test(f, mwe);
    test(f, mdme);
    test(f, me);

    if (FAILED) {
        throw new RuntimeException("Wrong mouse event");
    }
}
 
Example 5
public static void main(final String[] args) {
    final int mask = InputEvent.META_DOWN_MASK | InputEvent.CTRL_MASK;

    Frame f = new Frame();

    MouseEvent mwe = new MouseWheelEvent(f, 1, 1, mask, 1, 1, 1, 1, 1, true,
                                         1, 1, 1);
    MouseEvent mdme = new MenuDragMouseEvent(f, 1, 1, mask, 1, 1, 1, 1, 1,
                                             true, null, null);
    MouseEvent me = new MouseEvent(f, 1, 1, mask, 1, 1, 1, 1, 1, true,
                                   MouseEvent.NOBUTTON);

    test(f, mwe);
    test(f, mdme);
    test(f, me);

    if (FAILED) {
        throw new RuntimeException("Wrong mouse event");
    }
}
 
Example 6
Source Project: openjdk-jdk9   Source File: bug7170657.java    License: GNU General Public License v2.0 6 votes vote down vote up
public static void main(final String[] args) {
    final int mask = InputEvent.META_DOWN_MASK | InputEvent.CTRL_MASK;

    Frame f = new Frame();

    MouseEvent mwe = new MouseWheelEvent(f, 1, 1, mask, 1, 1, 1, 1, 1, true,
                                         1, 1, 1);
    MouseEvent mdme = new MenuDragMouseEvent(f, 1, 1, mask, 1, 1, 1, 1, 1,
                                             true, null, null);
    MouseEvent me = new MouseEvent(f, 1, 1, mask, 1, 1, 1, 1, 1, true,
                                   MouseEvent.NOBUTTON);

    test(f, mwe);
    test(f, mdme);
    test(f, me);

    if (FAILED) {
        throw new RuntimeException("Wrong mouse event");
    }
}
 
Example 7
Source Project: jdk8u-jdk   Source File: bug7170657.java    License: GNU General Public License v2.0 6 votes vote down vote up
public static void main(final String[] args) {
    final int mask = InputEvent.META_DOWN_MASK | InputEvent.CTRL_MASK;

    Frame f = new Frame();

    MouseEvent mwe = new MouseWheelEvent(f, 1, 1, mask, 1, 1, 1, 1, 1, true,
                                         1, 1, 1);
    MouseEvent mdme = new MenuDragMouseEvent(f, 1, 1, mask, 1, 1, 1, 1, 1,
                                             true, null, null);
    MouseEvent me = new MouseEvent(f, 1, 1, mask, 1, 1, 1, 1, 1, true,
                                   MouseEvent.NOBUTTON);

    test(f, mwe);
    test(f, mdme);
    test(f, me);

    if (FAILED) {
        throw new RuntimeException("Wrong mouse event");
    }
}
 
Example 8
Source Project: hottub   Source File: bug7170657.java    License: GNU General Public License v2.0 6 votes vote down vote up
public static void main(final String[] args) {
    final int mask = InputEvent.META_DOWN_MASK | InputEvent.CTRL_MASK;

    Frame f = new Frame();

    MouseEvent mwe = new MouseWheelEvent(f, 1, 1, mask, 1, 1, 1, 1, 1, true,
                                         1, 1, 1);
    MouseEvent mdme = new MenuDragMouseEvent(f, 1, 1, mask, 1, 1, 1, 1, 1,
                                             true, null, null);
    MouseEvent me = new MouseEvent(f, 1, 1, mask, 1, 1, 1, 1, 1, true,
                                   MouseEvent.NOBUTTON);

    test(f, mwe);
    test(f, mdme);
    test(f, me);

    if (FAILED) {
        throw new RuntimeException("Wrong mouse event");
    }
}
 
Example 9
Source Project: openjdk-8-source   Source File: bug7170657.java    License: GNU General Public License v2.0 6 votes vote down vote up
public static void main(final String[] args) {
    final int mask = InputEvent.META_DOWN_MASK | InputEvent.CTRL_MASK;

    Frame f = new Frame();

    MouseEvent mwe = new MouseWheelEvent(f, 1, 1, mask, 1, 1, 1, 1, 1, true,
                                         1, 1, 1);
    MouseEvent mdme = new MenuDragMouseEvent(f, 1, 1, mask, 1, 1, 1, 1, 1,
                                             true, null, null);
    MouseEvent me = new MouseEvent(f, 1, 1, mask, 1, 1, 1, 1, 1, true,
                                   MouseEvent.NOBUTTON);

    test(f, mwe);
    test(f, mdme);
    test(f, me);

    if (FAILED) {
        throw new RuntimeException("Wrong mouse event");
    }
}
 
Example 10
Source Project: openjdk-8   Source File: bug7170657.java    License: GNU General Public License v2.0 6 votes vote down vote up
public static void main(final String[] args) {
    final int mask = InputEvent.META_DOWN_MASK | InputEvent.CTRL_MASK;

    Frame f = new Frame();

    MouseEvent mwe = new MouseWheelEvent(f, 1, 1, mask, 1, 1, 1, 1, 1, true,
                                         1, 1, 1);
    MouseEvent mdme = new MenuDragMouseEvent(f, 1, 1, mask, 1, 1, 1, 1, 1,
                                             true, null, null);
    MouseEvent me = new MouseEvent(f, 1, 1, mask, 1, 1, 1, 1, 1, true,
                                   MouseEvent.NOBUTTON);

    test(f, mwe);
    test(f, mdme);
    test(f, me);

    if (FAILED) {
        throw new RuntimeException("Wrong mouse event");
    }
}
 
Example 11
Source Project: jdk8u_jdk   Source File: bug7170657.java    License: GNU General Public License v2.0 6 votes vote down vote up
public static void main(final String[] args) {
    final int mask = InputEvent.META_DOWN_MASK | InputEvent.CTRL_MASK;

    Frame f = new Frame();

    MouseEvent mwe = new MouseWheelEvent(f, 1, 1, mask, 1, 1, 1, 1, 1, true,
                                         1, 1, 1);
    MouseEvent mdme = new MenuDragMouseEvent(f, 1, 1, mask, 1, 1, 1, 1, 1,
                                             true, null, null);
    MouseEvent me = new MouseEvent(f, 1, 1, mask, 1, 1, 1, 1, 1, true,
                                   MouseEvent.NOBUTTON);

    test(f, mwe);
    test(f, mdme);
    test(f, me);

    if (FAILED) {
        throw new RuntimeException("Wrong mouse event");
    }
}
 
Example 12
Source Project: jdk8u-jdk   Source File: bug7170657.java    License: GNU General Public License v2.0 6 votes vote down vote up
public static void main(final String[] args) {
    final int mask = InputEvent.META_DOWN_MASK | InputEvent.CTRL_MASK;

    Frame f = new Frame();

    MouseEvent mwe = new MouseWheelEvent(f, 1, 1, mask, 1, 1, 1, 1, 1, true,
                                         1, 1, 1);
    MouseEvent mdme = new MenuDragMouseEvent(f, 1, 1, mask, 1, 1, 1, 1, 1,
                                             true, null, null);
    MouseEvent me = new MouseEvent(f, 1, 1, mask, 1, 1, 1, 1, 1, true,
                                   MouseEvent.NOBUTTON);

    test(f, mwe);
    test(f, mdme);
    test(f, me);

    if (FAILED) {
        throw new RuntimeException("Wrong mouse event");
    }
}
 
Example 13
Source Project: jdk8u-dev-jdk   Source File: bug7170657.java    License: GNU General Public License v2.0 6 votes vote down vote up
public static void main(final String[] args) {
    final int mask = InputEvent.META_DOWN_MASK | InputEvent.CTRL_MASK;

    Frame f = new Frame();

    MouseEvent mwe = new MouseWheelEvent(f, 1, 1, mask, 1, 1, 1, 1, 1, true,
                                         1, 1, 1);
    MouseEvent mdme = new MenuDragMouseEvent(f, 1, 1, mask, 1, 1, 1, 1, 1,
                                             true, null, null);
    MouseEvent me = new MouseEvent(f, 1, 1, mask, 1, 1, 1, 1, 1, true,
                                   MouseEvent.NOBUTTON);

    test(f, mwe);
    test(f, mdme);
    test(f, me);

    if (FAILED) {
        throw new RuntimeException("Wrong mouse event");
    }
}
 
Example 14
/**
 * Maps {@code JMenuItem.processMenuDragMouseEvent(MenuDragMouseEvent)}
 * through queue
 */
public void processMenuDragMouseEvent(final MenuDragMouseEvent menuDragMouseEvent) {
    runMapping(new MapVoidAction("processMenuDragMouseEvent") {
        @Override
        public void map() {
            ((JMenuItem) getSource()).processMenuDragMouseEvent(menuDragMouseEvent);
        }
    });
}
 
Example 15
Source Project: consulo   Source File: MouseEventAdapter.java    License: Apache License 2.0 5 votes vote down vote up
public static MouseEvent convert(MouseEvent event, Component source, int id, long when, int modifiers, int x, int y) {
  if (event instanceof MouseWheelEvent) return convert((MouseWheelEvent)event, source, id, when, modifiers, x, y);
  if (event instanceof MenuDragMouseEvent) return convert((MenuDragMouseEvent)event, source, id, when, modifiers, x, y);
  return new MouseEvent(source, id, when, modifiers, x, y,
                        event.getClickCount(),
                        event.isPopupTrigger(),
                        event.getButton());
}
 
Example 16
Source Project: consulo   Source File: MouseEventAdapter.java    License: 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 17
Source Project: consulo   Source File: BegMenuItemUI.java    License: 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 18
Source Project: consulo   Source File: ModernMenuItemUI.java    License: 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 19
Source Project: consulo   Source File: BegMenuItemUI.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void menuDragMouseEntered(MenuDragMouseEvent e) {
}
 
Example 20
Source Project: consulo   Source File: BegMenuItemUI.java    License: 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 21
Source Project: consulo   Source File: BegMenuItemUI.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void menuDragMouseExited(MenuDragMouseEvent e) {
}
 
Example 22
Source Project: consulo   Source File: ModernMenuItemUI.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void menuDragMouseEntered(MenuDragMouseEvent e) {
}
 
Example 23
Source Project: consulo   Source File: ModernMenuItemUI.java    License: 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 24
Source Project: consulo   Source File: ModernMenuItemUI.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void menuDragMouseExited(MenuDragMouseEvent e) {
}