org.eclipse.swt.events.MouseEvent类的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(8.5k)|赞(0)|评价(0)|浏览(161)

本文整理了Java中org.eclipse.swt.events.MouseEvent类的一些代码示例,展示了MouseEvent类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MouseEvent类的具体详情如下:
包路径:org.eclipse.swt.events.MouseEvent
类名称:MouseEvent

MouseEvent介绍

[英]Instances of this class are sent whenever mouse related actions occur. This includes mouse buttons being pressed and released, the mouse pointer being moved and the mouse pointer crossing widget boundaries.

Note: The button field is an integer that represents the mouse button number. This is not the same as the SWT mask constants BUTTONx.
[中]每当发生与鼠标相关的操作时,都会发送此类的实例。这包括按下和释放鼠标按钮、移动鼠标指针和跨越小部件边界的鼠标指针。
注意:button字段是一个整数,表示鼠标按钮的编号。这与SWT掩码常量BUTTONx不同。

代码示例

代码示例来源:origin: com.metsci.glimpse/glimpse-extras-swt

@Override
protected boolean isValid( MouseEvent e, GlimpseBounds bounds )
{
  return e.getSource( ) instanceof Control;
}

代码示例来源:origin: com.metsci.glimpse/glimpse-extras-swt

protected MouseEvent toLocalCoords( MouseEvent e, GlimpseTargetStack stack )
{
  if ( stack == null ) return null;
  GlimpseBounds bounds = stack.getBounds( );
  if ( bounds == null ) return null;
  if ( ! ( e.getSource( ) instanceof Control ) ) return null;
  Rectangle parentBounds = ( ( Control ) e.getSource( ) ).getBounds( );
  int parentHeight = parentBounds.height;
  Event localEvent = new Event( );
  localEvent.x = e.x - bounds.getX( );
  localEvent.y = e.y - ( parentHeight - ( bounds.getY( ) + bounds.getHeight( ) ) );
  localEvent.button = e.button;
  localEvent.count = e.count;
  localEvent.display = e.display;
  localEvent.stateMask = e.stateMask;
  localEvent.time = e.time;
  localEvent.widget = e.widget;
  // store the GlimpseTargetStack in the data field (marked as for application use)
  localEvent.data = stack;
  return new MouseEvent( localEvent );
}

代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt.q07

private static void writeMouseListener( Control control ) throws IOException {
 boolean hasListener = MouseEvent.hasListener( control );
 JSWriter writer = JSWriter.getWriterFor( control );
 writer.updateListener( MOUSE_UP_LISTENER_INFO, PROP_MOUSE_LISTENER, hasListener );
 writer.updateListener( MOUSE_DOWN_LISTENER_INFO, PROP_MOUSE_LISTENER, hasListener );
}

代码示例来源:origin: Renanse/Ardor3D

@Before
public void setup() throws Exception {
  control = createMock("control", SwtCanvas.class);
  wrapper = new SwtMouseWrapper(control);
  final Event event = new Event();
  event.widget = control;
  e1 = new MouseEvent(event);
  e2 = new MouseEvent(event);
  mocks = new Object[] { control };
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.examples

case SWT.MouseDoubleClick:
case SWT.MouseWheel:
case SWT.MouseHover: toString += new MouseEvent (event).toString (); break;
case SWT.Paint: toString += new PaintEvent (event).toString (); break;
case SWT.Move:

代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt.q07

private static void checkAndProcessMouseEvent( MouseEvent event ) {
 boolean pass = false;
 Control control = ( Control )event.widget;
 if( control instanceof Scrollable ) {
  Scrollable scrollable = ( Scrollable )control;
  Rectangle clientArea = scrollable.getClientArea();
  pass = clientArea.contains( event.x, event.y );
 } else {
  pass = event.x >= 0 && event.y >= 0;
 }
 if( pass ) {
  event.processEvent();
 }
}

代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt.q07

public static void processMouseEvents( Control control ) {
 if( WidgetLCAUtil.wasEventSent( control, JSConst.EVENT_MOUSE_DOWN ) ) {
  MouseEvent event = new MouseEvent( control, MouseEvent.MOUSE_DOWN );
  event.button = readIntParam( JSConst.EVENT_MOUSE_DOWN_BUTTON );
  Point point = readXYParams( control, JSConst.EVENT_MOUSE_DOWN_X, JSConst.EVENT_MOUSE_DOWN_Y );
  MouseEvent event = new MouseEvent( control, MouseEvent.MOUSE_DOUBLE_CLICK );
  event.button = readIntParam( JSConst.EVENT_MOUSE_DOUBLE_CLICK_BUTTON );
  Point point = readXYParams( control,
  MouseEvent event = new MouseEvent( control, MouseEvent.MOUSE_UP );
  event.button = readIntParam( JSConst.EVENT_MOUSE_UP_BUTTON );
  Point point = readXYParams( control, JSConst.EVENT_MOUSE_UP_X, JSConst.EVENT_MOUSE_UP_Y );

代码示例来源:origin: org.piccolo2d/piccolo2d-swt

/** {@inheritDoc} */
public Object getSource() {
  return swtEvent.getSource();
}

代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64

((MouseListener) eventListener).mouseDown(new MouseEvent(e));
break;
((MouseListener) eventListener).mouseDoubleClick(new MouseEvent(e));
break;
((MouseTrackListener) eventListener).mouseEnter (new MouseEvent (e));
break;
((MouseTrackListener) eventListener).mouseExit (new MouseEvent (e));
break;
((MouseTrackListener) eventListener).mouseHover (new MouseEvent (e));
break;
((MouseMoveListener) eventListener).mouseMove(new MouseEvent(e));
return;
((MouseWheelListener) eventListener).mouseScrolled(new MouseEvent(e));
return;
((MouseListener) eventListener).mouseUp(new MouseEvent(e));
break;

代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt.q07

adapter.preserve( PROP_ACTIVATE_LISTENER,
         Boolean.valueOf( ActivateEvent.hasListener( control ) ) );
adapter.preserve( PROP_MOUSE_LISTENER, Boolean.valueOf( MouseEvent.hasListener( control ) ) );
if( ( control.getStyle() & SWT.NO_FOCUS ) == 0 ) {
 adapter.preserve( PROP_FOCUS_LISTENER, Boolean.valueOf( FocusEvent.hasListener( control ) ) );

代码示例来源:origin: org.eclipse/org.eclipse.wst.common.frameworks.ui

/**
 * @see org.eclipse.swt.events.MouseListener#mouseUp(MouseEvent)
 */
public void mouseUp(MouseEvent e) {
  monitoringTarget = (Widget) e.getSource();
  restart();
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc

((MouseListener) eventListener).mouseDown(new MouseEvent(e));
break;
((MouseListener) eventListener).mouseDoubleClick(new MouseEvent(e));
break;
((MouseTrackListener) eventListener).mouseEnter (new MouseEvent (e));
break;
((MouseTrackListener) eventListener).mouseExit (new MouseEvent (e));
break;
((MouseTrackListener) eventListener).mouseHover (new MouseEvent (e));
break;
((MouseMoveListener) eventListener).mouseMove(new MouseEvent(e));
return;
((MouseWheelListener) eventListener).mouseScrolled(new MouseEvent(e));
return;
((MouseListener) eventListener).mouseUp(new MouseEvent(e));
break;

代码示例来源:origin: org.xworker/xworker_swt

public void mouseExit(MouseEvent e) {
  lastControl = null;
  thread.cancel = true;
  
  Control control = (Control) e.getSource();	
  closeToolTip(control);
  //if(toolTipShell != null)
  //	toolTipShell.dispose();		
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x

((MouseListener) eventListener).mouseDown(new MouseEvent(e));
break;
((MouseListener) eventListener).mouseDoubleClick(new MouseEvent(e));
break;
((MouseTrackListener) eventListener).mouseEnter (new MouseEvent (e));
break;
((MouseTrackListener) eventListener).mouseExit (new MouseEvent (e));
break;
((MouseTrackListener) eventListener).mouseHover (new MouseEvent (e));
break;
((MouseMoveListener) eventListener).mouseMove(new MouseEvent(e));
return;
((MouseWheelListener) eventListener).mouseScrolled(new MouseEvent(e));
return;
((MouseListener) eventListener).mouseUp(new MouseEvent(e));
break;

代码示例来源:origin: org.eclipse/org.eclipse.jdt.ui

public void mouseUp(MouseEvent e) {
    if (tree.getSelectionCount() < 1)
      return;
    if (e.button != 1)
      return;
    if (tree.equals(e.getSource())) {
      Object o= tree.getItem(new Point(e.x, e.y));
      TreeItem selection= tree.getSelection()[0];
      if (selection.equals(o))
        gotoSelectedElement();
    }
  }
});

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc

((MouseListener) eventListener).mouseDown(new MouseEvent(e));
break;
((MouseListener) eventListener).mouseDoubleClick(new MouseEvent(e));
break;
((MouseTrackListener) eventListener).mouseEnter (new MouseEvent (e));
break;
((MouseTrackListener) eventListener).mouseExit (new MouseEvent (e));
break;
((MouseTrackListener) eventListener).mouseHover (new MouseEvent (e));
break;
((MouseMoveListener) eventListener).mouseMove(new MouseEvent(e));
return;
((MouseWheelListener) eventListener).mouseScrolled(new MouseEvent(e));
return;
((MouseListener) eventListener).mouseUp(new MouseEvent(e));
break;

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui

@Override
public void mouseEnter(MouseEvent e) {
  Item item= (Item) ((Widget) e.getSource()).getData();
  if (item != null)
    item.selected();
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86

((MouseListener) eventListener).mouseDown(new MouseEvent(e));
break;
((MouseListener) eventListener).mouseDoubleClick(new MouseEvent(e));
break;
((MouseTrackListener) eventListener).mouseEnter (new MouseEvent (e));
break;
((MouseTrackListener) eventListener).mouseExit (new MouseEvent (e));
break;
((MouseTrackListener) eventListener).mouseHover (new MouseEvent (e));
break;
((MouseMoveListener) eventListener).mouseMove(new MouseEvent(e));
return;
((MouseWheelListener) eventListener).mouseScrolled(new MouseEvent(e));
return;
((MouseListener) eventListener).mouseUp(new MouseEvent(e));
break;

代码示例来源:origin: org.eclipse/org.eclipse.jdt.ui

public void mouseEnter(MouseEvent e) {
  Item item= (Item) ((Widget) e.getSource()).getData();
  if (item != null)
    item.selected();
}

代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt

((MouseListener) eventListener).mouseDown(new MouseEvent(e));
break;
((MouseListener) eventListener).mouseDoubleClick(new MouseEvent(e));
break;
((MouseListener) eventListener).mouseUp(new MouseEvent(e));
break;

相关文章