org.eclipse.swt.widgets.Widget.getDisplay()方法的使用及代码示例

x33g5p2x  于2022-02-02 转载在 其他  
字(5.4k)|赞(0)|评价(0)|浏览(260)

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

Widget.getDisplay介绍

[英]Returns the Display that is associated with the receiver.

A widget's display is either provided when it is created (for example, top level Shells) or is the same as its parent's display.
[中]返回与接收器关联的Display
小部件的显示要么在创建时提供(例如,顶层Shells),要么与其父部件的显示相同。

代码示例

代码示例来源:origin: org.pushingpixels/trident

@Override
  public void runOnUIThread(Object mainTimelineObject, Runnable runnable) {
    ((Widget) mainTimelineObject).getDisplay().asyncExec(runnable);
  }
}

代码示例来源:origin: org.pushing-pixels/trident

@Override
  public void runOnUIThread(Object mainTimelineObject, Runnable runnable) {
    ((Widget) mainTimelineObject).getDisplay().asyncExec(runnable);
  }
}

代码示例来源:origin: com.github.insubstantial/trident

@Override
  public void runOnUIThread(Object mainTimelineObject, Runnable runnable) {
    ((Widget) mainTimelineObject).getDisplay().asyncExec(runnable);
  }
}

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

public static Event newEvent( Widget widget, int eventType ) {
 Event event = new Event();
 event.type = eventType;
 event.widget = widget;
 event.display = widget.getDisplay();
 return event;
}

代码示例来源:origin: org.eclipse.e4.ui.css/swt

/**
 * Convenience method for getting the CSS engine responsible for a widget.
 * @param widget SWT widget which is styled by an engine
 */
public static CSSEngine getEngine(Widget widget) {
  return getEngine(widget.getDisplay());
}

代码示例来源:origin: rherrmann/eclipse-extras

private void updateAnimation() {
 dotCount = 0;
 if( text.endsWith( DOTS ) ) {
  widget.getDisplay().timerExec( animationInterval, this );
 }
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.e4.ui.css.swt

/**
 * Convenience method for getting the CSS engine responsible for a widget.
 * @param widget SWT widget which is styled by an engine
 */
public static CSSEngine getEngine(Widget widget) {
  return getEngine(widget.getDisplay());
}

代码示例来源:origin: com.diffplug.durian/durian-swt

/** Returns an image which will be bound to the lifecycle of the owner widget. */
  public static Image getFromPool(Widget owner, ImageDescriptor descriptor) {
    Map<ImageDescriptor, Image> map = globalPool.forWidget(owner);
    Image image = map.get(descriptor);
    if (image == null) {
      image = descriptor.createImage(true, owner.getDisplay());
      map.put(descriptor, image);
    }
    return image;
  }
}

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

public void treeCollapsed( TreeEvent e ) {
 if( editor == null || editor.isDisposed() )
  return;
 editor.setVisible( false );
 e.widget.getDisplay().asyncExec( runnable );
}

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

public void treeExpanded( TreeEvent e ) {
  if( editor == null || editor.isDisposed() )
   return;
  editor.setVisible( false );
  e.widget.getDisplay().asyncExec( runnable );
 }
};

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

@Override
  public void focusLost(FocusEvent e) {
    Widget w = e.widget;
    if (w instanceof Control) {
      handleNextFocusGained = w.getDisplay().getActiveShell() == ((Control) w).getShell();
    }
  }
}

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

/**
 * The color to use when rendering the background of the selected cell when
 * the control has the input focus
 *
 * @param cell
 *            the cell which is colored
 * @return the color or <code>null</code> to use the default
 */
protected Color getSelectedCellBackgroundColor(ViewerCell cell) {
  return removeNonFocusedSelectionInformation ? null
      : cell.getItem().getDisplay().getSystemColor(SWT.COLOR_LIST_SELECTION);
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.jface.databinding

@Override
  public ISWTObservableList observe(Widget widget) {
    return (ISWTObservableList) observe(DisplayRealm.getRealm(widget
        .getDisplay()), widget);
  }
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.forms

@Override
  public void focusLost(FocusEvent e) {
    Widget w = e.widget;
    if (w instanceof Control) {
      handleNextFocusGained = w.getDisplay().getActiveShell() == ((Control) w).getShell();
    }
  }
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.jface.databinding

@Override
public ISWTObservableValue observe(Widget widget) {
  return (ISWTObservableValue) observe(DisplayRealm.getRealm(widget
      .getDisplay()), widget);
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.jface.databinding

@Override
  public ISWTObservableList observe(Widget widget) {
    return (ISWTObservableList) observe(DisplayRealm.getRealm(widget
        .getDisplay()), widget);
  }
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.jface.databinding

@Override
public ISWTObservableValue observe(Widget widget) {
  return (ISWTObservableValue) observe(DisplayRealm.getRealm(widget
      .getDisplay()), widget);
}

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

@Override
  public void mouseMove(MouseEvent e) {
    Cursor cursor= null;
    Diff diff= handlemouseInBirdsEyeView(fBirdsEyeCanvas, e.y);
    if (diff != null && diff.getKind() != RangeDifference.NOCHANGE)
      cursor= e.widget.getDisplay().getSystemCursor(SWT.CURSOR_HAND);
    if (fLastCursor != cursor) {
      fBirdsEyeCanvas.setCursor(cursor);
      fLastCursor= cursor;
    }
  }
}

代码示例来源:origin: com.diffplug.durian/durian-swt

/** Creates an image from the given data, and disposes it when the lifecycle widget is disposed. */
public static Image createManagedImage(ImageData data, Widget lifecycle) {
  Image image = new Image(lifecycle.getDisplay(), data);
  lifecycle.addListener(SWT.Dispose, e -> {
    image.dispose();
  });
  return image;
}

代码示例来源:origin: org.eclipse.mylyn.commons/screenshots

public void handleEvent(Event e) {
    Color gcForeground = e.gc.getForeground();
    Rectangle bounds = ((Composite) e.widget).getBounds();
    Color border = e.widget.getDisplay().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW);
    e.gc.setForeground(border);
    e.gc.drawLine(bounds.width - 1, 0, bounds.width - 1, bounds.height);
    e.gc.setForeground(gcForeground);
  }
});

相关文章

Widget类方法