org.eclipse.swt.widgets.Widget类的使用及代码示例

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

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

Widget介绍

[英]This class is the abstract superclass of all user interface objects. Widgets are created, disposed and issue notification to listeners when events occur which affect them. Styles: (none) Events: Dispose

IMPORTANT: This class is intended to be subclassed only within the SWT implementation. However, it has not been marked final to allow those outside of the SWT development team to implement patched versions of the class in order to get around specific limitations in advance of when those limitations can be addressed by the team. Any class built using subclassing to access the internals of this class will likely fail to compile or run between releases and may be strongly platform specific. Subclassing should not be attempted without an intimate and detailed understanding of the workings of the hierarchy. No support is provided for user-written classes which are implemented as subclasses of this class.
[中]此类是所有用户界面对象的抽象超类。小部件被创建、处理,并在发生影响它们的事件时向侦听器发出通知。样式:(无)事件:Dispose
重要提示:该类仅在SWT实现中被子类化。然而,允许SWT开发团队之外的人实现类的补丁版本,以便在团队能够解决这些限制之前绕过特定的限制,这还没有被标记为最终版本。任何使用子类化来访问该类内部的类都可能无法编译或在不同版本之间运行,并且可能是非常特定于平台的。如果没有对层次结构的工作原理有深入而详细的了解,就不应该尝试子类化。不支持作为此类子类实现的用户编写的类。

代码示例

代码示例来源:origin: pentaho/pentaho-kettle

private boolean controlDisposed( XulToolbarbutton button ) {
 if ( button.getManagedObject() instanceof Widget ) {
  Widget widget = (Widget) button.getManagedObject();
  return widget.isDisposed();
 }
 return false;
}

代码示例来源:origin: BiglySoftware/BiglyBT

@Override
public void widgetSelected(SelectionEvent e) {
  Object device = e.widget.getData("Device");
  if (device instanceof TranscodeTarget) {
    selectedTranscodeTarget = (TranscodeTarget) device;
  } else if (device instanceof DeviceTemplate) {
    selectedDeviceTemplate = (DeviceTemplate) device;
  }
}

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

private static void storeDefaultFont(Widget widget, Font font) {
  if (widget.getData(DEFAULT_FONT) == null) {
    widget.setData(DEFAULT_FONT, font);
  }
}

代码示例来源:origin: BiglySoftware/BiglyBT

private static String getID(Widget widget) {
  if (null != widget && !widget.isDisposed()) {
    Object id = widget.getData(KEY_MENU_ID);
    if (null != id) {
      return id.toString();
    }
  }
  return "";
}

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

/**
 * 绑定到一个控件上。
 * 
 * @param widget
 */
public static void attach(Widget widget){
  if(widget.getData(KEY) == null){
    widget.addListener(SWT.Dispose, instance);
    widget.setData(KEY, KEY);
  }
}

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

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

代码示例来源:origin: BiglySoftware/BiglyBT

public static void setEnablementKeys(Widget widget, int keys) {
  if (null != widget && !widget.isDisposed()) {
    widget.setData(KEY_ENABLEMENT, new Integer(keys));
  }
}

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

@Override
public void hideChild(MElementContainer<MUIElement> parentElement,
    MUIElement child) {
  super.hideChild(parentElement, child);
  // Since there's no place to 'store' a child that's not in a menu
  // we'll blow it away and re-create on an add
  Widget widget = (Widget) child.getWidget();
  if (widget != null && !widget.isDisposed())
    widget.dispose();
}

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

@Override
public void run() {
 if( !widget.isDisposed() ) {
  increaseDotCount();
  textAnimationPainter.drawText( this );
  widget.getDisplay().timerExec( animationInterval, this );
 }
}

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

boolean sendKeyEvent (int type, int msg, int /*long*/ wParam, int /*long*/ lParam, Event event) {
  sendEvent (type, event);
  if (isDisposed ()) return false;
  return event.doit;
}

代码示例来源:origin: BiglySoftware/BiglyBT

private static void
setLanguageText(Widget widget,  String key, String[] params, boolean setTooltipOnly) {
  widget.setData(RESOURCE_KEY,key);
  if(!setTooltipOnly)
  updateLanguageFromData(widget, params);
  widget.removeListener(SWT.MouseHover, hoverListener);
  widget.addListener(SWT.MouseHover, hoverListener);
}

代码示例来源: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.apache.uima/uimaj-ep-configurator

/**
 * Adds the listener for pastable widget.
 *
 * @param w the w
 */
// **************************************************
protected void addListenerForPastableWidget(Widget w) {
 w.addListener(SWT.KeyUp, this);
 w.addListener(SWT.MouseUp, this); // for paste operation
}

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

boolean sendDragEvent (int button, int stateMask, int x, int y) {
  Event event = new Event ();
  event.button = button;
  event.setLocationInPixels(x, y);
  event.stateMask = stateMask;
  postEvent (SWT.DragDetect, event);
  if (isDisposed ()) return false;
  return event.doit;
}

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

private void release() {
 if( decoratedWidget != null && !decoratedWidget.isDisposed() ) {
  removeDisposeListener( disposeListener );
  decoratedWidget.removeDisposeListener( disposeListener );
  disposeListener = null;
  unbindDecoration();
  decoratedWidget = null;
  dispose();
 }
}

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

public static void setBackgroundOverriddenByCSSMarker(Widget widget) {
  if (widget instanceof Composite && !(widget instanceof CTabFolder)) {
    widget.setData(BACKGROUND_OVERRIDDEN_BY_CSS_MARKER, true);
  }
}

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

public void dispose() {
  if (widget != null) {
    widget.dispose();
    widget = null;
  }
  holdMenu = null;
}

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

@Override
  public void widgetSelected(SelectionEvent event) {
    setAccessModifier((String)event.widget.getData());
  }
});

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

private static void storeDefaultImage(Widget widget, String imageName,
    Image image) {
  if (widget.getData(imageName) == null) {
    widget.setData(imageName, image);
  }
}

代码示例来源:origin: BiglySoftware/BiglyBT

public static int getEnablementKeys(Widget widget) {
  if (null != widget && !widget.isDisposed()) {
    Object keys = widget.getData(KEY_ENABLEMENT);
    if (keys instanceof Integer) {
      return ((Integer) keys).intValue();
    }
  }
  return -1;
}

相关文章

Widget类方法