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

x33g5p2x  于2022-01-18 转载在 其他  
字(5.5k)|赞(0)|评价(0)|浏览(215)

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

Canvas.getDisplay介绍

暂无

代码示例

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

void refreshDifference() {
 Display display = canvas.getDisplay();
 DeviceData info = display.getDeviceData();
 if ( !info.tracking ) {

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

/**
 * Returns the Display on which the PaintSurface resides.
 * @return the Display
 */
public Display getDisplay() {
  return paintCanvas.getDisplay();
}

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

public Device getDevice() {
  return simpleDraw2d.imageCanvas.getDisplay();
}

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

/**
 * Creates a new header painter.
 */
public HeaderPainter() {
  fSeparatorColor= fHeader.getDisplay().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW);
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface.text

/**
 * Creates a new header painter.
 */
public HeaderPainter() {
  fSeparatorColor= fHeader.getDisplay().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW);
}

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

@Override
public void update() {
  if (fCanvas != null && !fCanvas.isDisposed()) {
    Display d= fCanvas.getDisplay();
    if (d != null) {
      synchronized (fRunnableLock) {
        if (fIsRunnablePosted)
          return;
        fIsRunnablePosted= true;
      }
      d.asyncExec(fRunnable);
    }
  }
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface.text

@Override
public void update() {
  if (fCanvas != null && !fCanvas.isDisposed()) {
    Display d= fCanvas.getDisplay();
    if (d != null) {
      synchronized (fRunnableLock) {
        if (fIsRunnablePosted)
          return;
        fIsRunnablePosted= true;
      }
      d.asyncExec(fRunnable);
    }
  }
}

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

public HeaderPainter() {
  fSeparatorColor= fSummaryHeader.getDisplay().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW);
}

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

/**
 * Post a redraw request for this column into the UI thread.
 */
private void postRedraw() {
  if (fCanvas != null && !fCanvas.isDisposed()) {
    Display d= fCanvas.getDisplay();
    if (d != null) {
      d.asyncExec(() -> redraw());
    }
  }
}

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

/**
 * Triggers a redraw in the display thread.
 */
protected final void postRedraw() {
  if (fCanvas != null && !fCanvas.isDisposed()) {
    Display d= fCanvas.getDisplay();
    if (d != null) {
      d.asyncExec(() -> redraw());
    }
  }
}

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

/**
 * Thread-safe implementation.
 * Can be called from any thread.
 */
@Override
public void update() {
  if (fCanvas != null && !fCanvas.isDisposed()) {
    Display d= fCanvas.getDisplay();
    if (d != null) {
      d.asyncExec(() -> redraw());
    }
  }
}

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

public void setAutoAlpha(boolean autoAlpha) {
  this.autoAlpha = autoAlpha;
  if (autoAlpha) {
    setAlpha(canvas.getDisplay().getCursorControl() == canvas ? ALPHA_FOCUS : ALPHA_NOFOCUS);
  }
}

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

private void setAutoAlpha(boolean autoAlpha) {
  this.autoAlpha = autoAlpha;
  if (autoAlpha) {
    setAlpha(drawCanvas.getDisplay().getCursorControl() == drawCanvas ? ALPHA_FOCUS : ALPHA_NOFOCUS);
  }
}

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

public void setAutoAlpha(boolean autoAlpha) {
  this.autoAlpha = autoAlpha;
  if (autoAlpha) {
    setAlpha(canvas.getDisplay().getCursorControl() == canvas ? ALPHA_FOCUS : ALPHA_NOFOCUS);
  }
}

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

public void setAutoAlpha(boolean autoAlpha) {
  this.autoAlpha = autoAlpha;
  if (autoAlpha) {
    setAlpha(canvas.getDisplay().getCursorControl() == canvas ? ALPHA_FOCUS : ALPHA_NOFOCUS);
  }
}

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

/**
 * Sets the background color of this column.
 *
 * @param background the background color
 */
public void setBackground(Color background) {
  fBackground= background;
  if (fCanvas != null && !fCanvas.isDisposed())
    fCanvas.setBackground(getBackground(fCanvas.getDisplay()));
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface.text

/**
 * Sets the background color of this column.
 *
 * @param background the background color
 */
public void setBackground(Color background) {
  fBackground= background;
  if (fCanvas != null && !fCanvas.isDisposed())
    fCanvas.setBackground(getBackground(fCanvas.getDisplay()));
}

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

private void drawRangeIndication(GC gc, Canvas canvas, Rectangle r) {
  final int MARGIN= 3;
  /* cap the height - at least on GTK, large numbers are converted to
   * negatives at some point */
  int height= Math.min(r.y + r.height - MARGIN, canvas.getSize().y);
  gc.setForeground(canvas.getDisplay().getSystemColor(COLOR));
  gc.setLineWidth(0); // NOTE: 0 means width is 1 but with optimized performance
  gc.drawLine(r.x + 4, r.y + 12, r.x + 4, height);
  gc.drawLine(r.x + 4, height, r.x + r.width - MARGIN, height);
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface.text

private void drawRangeIndication(GC gc, Canvas canvas, Rectangle r) {
  final int MARGIN= 3;
  /* cap the height - at least on GTK, large numbers are converted to
   * negatives at some point */
  int height= Math.min(r.y + r.height - MARGIN, canvas.getSize().y);
  gc.setForeground(canvas.getDisplay().getSystemColor(COLOR));
  gc.setLineWidth(0); // NOTE: 0 means width is 1 but with optimized performance
  gc.drawLine(r.x + 4, r.y + 12, r.x + 4, height);
  gc.drawLine(r.x + 4, height, r.x + r.width - MARGIN, height);
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface.text

@Override
public void paint(GC gc, Canvas canvas, Rectangle rectangle) {
  Image image= getImage(canvas.getDisplay());
  if (image != null) {
    ImageUtilities.drawImage(image, gc, canvas, rectangle, SWT.CENTER, SWT.TOP);
    if (fIsRangeIndication) {
      FontMetrics fontMetrics= gc.getFontMetrics();
      int delta= (fontMetrics.getHeight() - image.getBounds().height)/2;
      rectangle.y += delta;
      rectangle.height -= delta;
      drawRangeIndication(gc, canvas, rectangle);
    }
  }
}

相关文章

Canvas类方法