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

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

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

Canvas.setCaret介绍

[英]Sets the receiver's caret.

The caret for the control is automatically hidden and shown when the control is painted or resized, when focus is gained or lost and when an the control is scrolled. To avoid drawing on top of the caret, the programmer must hide and show the caret when drawing in the window any other time.
[中]设置接收器的插入符号。
当绘制或调整控件大小、获得或丢失焦点以及滚动控件时,控件的插入符号将自动隐藏和显示。为了避免在插入符号的顶部绘制,程序员必须在任何其他时间在窗口中绘制时隐藏和显示插入符号。

代码示例

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

void createWidget () {
  isVisible = true;
  if (parent.getCaret () == null) {
    parent.setCaret (this);
  }
}

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

@Override
void releaseParent () {
  super.releaseParent ();
  if (this == parent.getCaret ()) parent.setCaret (null);
}

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

@Override
void releaseParent () {
  super.releaseParent ();
  if (this == parent.getCaret ()) parent.setCaret (null);
}

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

@Override
void releaseParent () {
  super.releaseParent ();
  if (this == parent.getCaret ()) parent.setCaret (null);
}

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

@Override
void releaseParent () {
  super.releaseParent ();
  if (this == parent.getCaret ()) parent.setCaret (null);
}

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

void releaseParent () {
  super.releaseParent ();
  if (this == parent.getCaret ()) parent.setCaret (null);
}

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

/**
 * Sets the receiver's caret.  Set the caret's height and location.
 * 
 * </p>
 * @param caret the new caret for the receiver
 *
 * @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 void setCaret(Caret caret) {
  checkWidget ();
  super.setCaret(caret);
  caretDirection = SWT.NULL;
  if (caret != null) {
    setCaretLocation();
  }
}
/**

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

/**
 * Sets the receiver's caret.  Set the caret's height and location.
 *
 * </p>
 * @param caret the new caret for the receiver
 *
 * @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>
 */
@Override
public void setCaret(Caret caret) {
  checkWidget ();
  super.setCaret(caret);
  caretDirection = SWT.NULL;
  if (caret != null) {
    setCaretLocation();
  }
}
/**

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

/**
 * Sets the receiver's caret.  Set the caret's height and location.
 *
 * </p>
 * @param caret the new caret for the receiver
 *
 * @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>
 */
@Override
public void setCaret(Caret caret) {
  checkWidget ();
  super.setCaret(caret);
  caretDirection = SWT.NULL;
  if (caret != null) {
    setCaretLocation();
  }
}
/**

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

void createWidget () {
  super.createWidget ();
  blinkRate = display.getCaretBlinkTime ();
  isVisible = true;
  if (parent.getCaret () == null) {
    parent.setCaret (this);
  }
}

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

@Override
void createWidget (int index) {
  super.createWidget (index);
  blinkRate = display.getCaretBlinkTime ();
  isVisible = true;
  if (parent.getCaret () == null) {
    parent.setCaret (this);
  }
}

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

/**
 * Sets the receiver's caret.  Set the caret's height and location.
 *
 * </p>
 * @param caret the new caret for the receiver
 *
 * @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>
 */
@Override
public void setCaret(Caret caret) {
  checkWidget ();
  super.setCaret(caret);
  caretDirection = SWT.NULL;
  if (caret != null) {
    setCaretLocation();
  }
}
/**

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

/**
 * Sets the receiver's caret.  Set the caret's height and location.
 *
 * </p>
 * @param caret the new caret for the receiver
 *
 * @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>
 */
@Override
public void setCaret(Caret caret) {
  checkWidget ();
  super.setCaret(caret);
  caretDirection = SWT.NULL;
  if (caret != null) {
    setCaretLocation();
  }
}
/**

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

@Override
void createWidget (int index) {
  super.createWidget (index);
  blinkRate = display.getCaretBlinkTime ();
  isVisible = true;
  if (parent.getCaret () == null) {
    parent.setCaret (this);
  }
}

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

@Override
void createWidget (int index) {
  super.createWidget (index);
  blinkRate = display.getCaretBlinkTime ();
  isVisible = true;
  if (parent.getCaret () == null) {
    parent.setCaret (this);
  }
}

代码示例来源: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: org.eclipse.platform/org.eclipse.swt.examples

canvas.setLayoutData(new GridData(64, 64));
canvas.addPaintListener(e -> e.gc.drawString("Canvas", 15, 25));
canvas.setCaret (new Caret(canvas, SWT.NONE));

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

canvas.setCaret (caret);
overrideCanvas.setCaret (caret);

相关文章

Canvas类方法