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

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

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

Canvas.getFont介绍

暂无

代码示例

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

/**
 * Returns the font that the receiver will use to paint textual information.
 *
 * @return the receiver's font
 *
 * @exception SWTException <ul>
 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
 * </ul>
 */
public Font getFont () {
  checkWidget();
  if (font != null) return font;
  return parent.getFont ();
}

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

/**
 * Returns the font that the receiver will use to paint textual information.
 *
 * @return the receiver's font
 *
 * @exception SWTException <ul>
 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
 * </ul>
 */
public Font getFont () {
  checkWidget();
  if (font != null) return font;
  return parent.getFont ();
}

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

/**
 * Returns the font that the receiver will use to paint textual information.
 *
 * @return the receiver's font
 *
 * @exception SWTException <ul>
 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
 * </ul>
 */
public Font getFont () {
  checkWidget();
  if (font != null) return font;
  return parent.getFont ();
}

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

/**
 * Returns the font that the receiver will use to paint textual information.
 *
 * @return the receiver's font
 *
 * @exception SWTException <ul>
 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
 * </ul>
 */
public Font getFont () {
  checkWidget();
  if (font != null) return font;
  return parent.getFont ();
}

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

/**
 * Computes the indentations for the given font and stores them in
 * <code>fIndentation</code>.
 */
protected void computeIndentations() {
  if (fCanvas == null || fCanvas.isDisposed())
    return;
  GC gc= new GC(fCanvas);
  try {
    gc.setFont(fCanvas.getFont());
    fIndentation= new int[fCachedNumberOfDigits + 1];
    char[] nines= new char[fCachedNumberOfDigits];
    Arrays.fill(nines, '9');
    String nineString= new String(nines);
    Point p= gc.stringExtent(nineString);
    fIndentation[0]= p.x;
    for (int i= 1; i <= fCachedNumberOfDigits; i++) {
      p= gc.stringExtent(nineString.substring(0, i));
      fIndentation[i]= fIndentation[0] - p.x;
    }
  } finally {
    gc.dispose();
  }
}

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

/**
 * Computes the indentations for the given font and stores them in
 * <code>fIndentation</code>.
 */
protected void computeIndentations() {
  if (fCanvas == null || fCanvas.isDisposed())
    return;
  GC gc= new GC(fCanvas);
  try {
    gc.setFont(fCanvas.getFont());
    fIndentation= new int[fCachedNumberOfDigits + 1];
    char[] nines= new char[fCachedNumberOfDigits];
    Arrays.fill(nines, '9');
    String nineString= new String(nines);
    Point p= gc.stringExtent(nineString);
    fIndentation[0]= p.x;
    for (int i= 1; i <= fCachedNumberOfDigits; i++) {
      p= gc.stringExtent(nineString.substring(0, i));
      fIndentation[i]= fIndentation[0] - p.x;
    }
  } finally {
    gc.dispose();
  }
}

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

SWT.DEFAULT, true, false, 2, 1));
font = FontUtils.getFontPercentOf(peerInfoCanvas.getFont(), 0.7f);

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

int iFontWeight = -1;
String sFontFace = null;
FontData[] tempFontData = canvas.getFont().getFontData();
  FontData[] fd = canvas.getFont().getFontData();

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

/**
 * Sets or clears the caret in the "Example" widget.
 */
void setCaret () {
  Caret oldCaret = canvas.getCaret ();
  if (caretButton.getSelection ()) {
    Caret newCaret = new Caret(canvas, SWT.NONE);
    Font font = canvas.getFont();
    newCaret.setFont(font);
    GC gc = new GC(canvas);
    gc.setFont(font);
    newCaret.setBounds(1, 1, 1, gc.getFontMetrics().getHeight());
    gc.dispose();
    canvas.setCaret (newCaret);
    canvas.setFocus();
  } else {
    canvas.setCaret (null);
  }
  if (oldCaret != null) oldCaret.dispose ();
}

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

}, new GridData(SWT.FILL, SWT.DEFAULT, true, false, 2, 1));
font = FontUtils.getFontPercentOf(pieceInfoCanvas.getFont(), 0.7f);

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

/**
 * Double buffer drawing.
 *
 * @param dest the GC to draw into
 */
private void doubleBufferPaint(GC dest) {
  Point size= fCanvas.getSize();
  if (size.x <= 0 || size.y <= 0)
    return;
  if (fBuffer != null) {
    Rectangle r= fBuffer.getBounds();
    if (r.width != size.x || r.height != size.y) {
      fBuffer.dispose();
      fBuffer= null;
    }
  }
  if (fBuffer == null)
    fBuffer= new Image(fCanvas.getDisplay(), size.x, size.y);
  GC gc= new GC(fBuffer);
  gc.setFont(fCanvas.getFont());
  try {
    gc.setBackground(getBackground());
    gc.fillRectangle(0, 0, size.x, size.y);
    doPaint(gc);
  } finally {
    gc.dispose();
  }
  dest.drawImage(fBuffer, 0, 0);
}

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

/**
 * Double buffer drawing.
 *
 * @param dest the GC to draw into
 */
private void doubleBufferPaint(GC dest) {
  Point size= fCanvas.getSize();
  if (size.x <= 0 || size.y <= 0)
    return;
  if (fBuffer != null) {
    Rectangle r= fBuffer.getBounds();
    if (r.width != size.x || r.height != size.y) {
      fBuffer.dispose();
      fBuffer= null;
    }
  }
  if (fBuffer == null)
    fBuffer= new Image(fCanvas.getDisplay(), size.x, size.y);
  GC gc= new GC(fBuffer);
  gc.setFont(fCanvas.getFont());
  try {
    gc.setBackground(getBackground());
    gc.fillRectangle(0, 0, size.x, size.y);
    doPaint(gc);
  } finally {
    gc.dispose();
  }
  dest.drawImage(fBuffer, 0, 0);
}

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

Font font= fCanvas.getFont();
  if (zoom != 100) {
    if (fLastFont != null && font == fLastFont.get()) {
gc.setFont(fCanvas.getFont());
if (fForeground != null)
  gc.setForeground(fForeground);

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

gc.setFont(fCanvas.getFont());
if (fForeground != null)
  gc.setForeground(fForeground);

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

fontHeader = FontUtils.getFontPercentOf(cHeaderArea.getFont(), 0.9f);
fontHeaderSmall = FontUtils.getFontPercentOf(fontHeader, 0.8f);
cHeaderArea.setFont(fontHeader);

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

Font font = canvas.getFont();
FontData[] fdata = font.getFontData();
fdata[0].setHeight(Constants.isOSX ? 9 : 7);

相关文章

Canvas类方法