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

x33g5p2x  于2022-01-29 转载在 其他  
字(3.7k)|赞(0)|评价(0)|浏览(100)

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

Text.getCaretLocation介绍

[英]Returns a point describing the location of the caret relative to the receiver.
[中]返回一个点,描述插入符号相对于接收器的位置。

代码示例

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

@Override
public Point getLocationAtOffset(int offset) {
  Point caretLocation= fText.getCaretLocation();
  /*
   * XXX: workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=52520
   */
  caretLocation.y += 2;
  return caretLocation;
}

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

@Override
public Point getLocationAtOffset(int offset) {
  Point caretLocation= fText.getCaretLocation();
  /*
   * XXX: workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=52520
   */
  caretLocation.y += 2;
  return caretLocation;
}

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

/**
 * Returns the line number of the caret.
 * <p>
 * The line number of the caret is returned.
 * </p>
 *
 * @return the line number
 *
 * @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 int getCaretLineNumber () {
  checkWidget ();
  if ((style & SWT.SINGLE) != 0) return 0;
  return (getTopPixel () + getCaretLocation ().y) / getLineHeight ();
}

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

@Override
public Rectangle getInsertionBounds(Control control) {
  Text text = (Text) control;
  Point caretOrigin = text.getCaretLocation();
  // We fudge the y pixels due to problems with getCaretLocation
  // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=52520
  return new Rectangle(caretOrigin.x + text.getClientArea().x,
      caretOrigin.y + text.getClientArea().y + 3, 1, text.getLineHeight());
}

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

@Override
public Rectangle getInsertionBounds(Control control) {
  Text text = (Text) control;
  Point caretOrigin = text.getCaretLocation();
  // We fudge the y pixels due to problems with getCaretLocation
  // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=52520
  return new Rectangle(caretOrigin.x + text.getClientArea().x,
      caretOrigin.y + text.getClientArea().y + 3, 1, text.getLineHeight());
}

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

SelectToolAction.int2rgb(drawTextToolbar.getIntgerCustom())));
textArea.setTabs(1);
Point point = textArea.getCaretLocation();
textArea.setBounds(new Rectangle(xs - point.x, ys, xe - xs + point.x + point.x, ye - ys));
textArea.setFocus();

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

int xCaret = text.getCaretLocation().x;
int offset = text.getCaretPosition();
while (xCaret < translatedPoint.x)
  xCaret = text.getCaretLocation().x;
  int newOffset = text.getCaretPosition();
  if (newOffset == offset)

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

e.y = event.y;
if (event.detail == SWT.MENU_KEYBOARD) {
  Point pt = getDisplay().map(text, null, text.getCaretLocation());
  e.x = pt.x;
  e.y = pt.y;

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

e.y = event.y;
if (event.detail == SWT.MENU_KEYBOARD) {
  Point pt = getDisplay().map(text, null, text.getCaretLocation());
  e.x = pt.x;
  e.y = pt.y;

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

e.y = event.y;
if (event.detail == SWT.MENU_KEYBOARD) {
  Point pt = getDisplay().map(text, null, text.getCaretLocation());
  e.x = pt.x;
  e.y = pt.y;

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

e.y = event.y;
if (event.detail == SWT.MENU_KEYBOARD) {
  Point pt = getDisplay().map(text, null, text.getCaretLocation());
  e.x = pt.x;
  e.y = pt.y;

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

e.y = event.y;
if (event.detail == SWT.MENU_KEYBOARD) {
  Point pt = getDisplay().map(text, null, text.getCaretLocation());
  e.x = pt.x;
  e.y = pt.y;

相关文章

Text类方法