当前位置: 首页>>代码示例>>Java>>正文


Java TextComponentPeer.getCaretPosition方法代码示例

本文整理汇总了Java中java.awt.peer.TextComponentPeer.getCaretPosition方法的典型用法代码示例。如果您正苦于以下问题:Java TextComponentPeer.getCaretPosition方法的具体用法?Java TextComponentPeer.getCaretPosition怎么用?Java TextComponentPeer.getCaretPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.awt.peer.TextComponentPeer的用法示例。


在下文中一共展示了TextComponentPeer.getCaretPosition方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getCaretPosition

import java.awt.peer.TextComponentPeer; //导入方法依赖的package包/类
/**
 * Returns the position of the text insertion caret.
 * The caret position is constrained to be between 0
 * and the last character of the text, inclusive.
 * If the text or caret have not been set, the default
 * caret position is 0.
 *
 * @return       the position of the text insertion caret
 * @see #setCaretPosition(int)
 * @since        JDK1.1
 */
public synchronized int getCaretPosition() {
    TextComponentPeer peer = (TextComponentPeer)this.peer;
    int position = 0;

    if (peer != null) {
        position = peer.getCaretPosition();
    } else {
        position = selectionStart;
    }
    int maxposition = getText().length();
    if (position > maxposition) {
        position = maxposition;
    }
    return position;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:27,代码来源:TextComponent.java

示例2: getCaretPosition

import java.awt.peer.TextComponentPeer; //导入方法依赖的package包/类
/**
 * Returns the position of the text insertion caret.
 * The caret position is constrained to be between 0
 * and the last character of the text, inclusive.
 * If the text or caret have not been set, the default
 * caret position is 0.
 *
 * @return       the position of the text insertion caret
 * @see #setCaretPosition(int)
 * @since        1.1
 */
public synchronized int getCaretPosition() {
    TextComponentPeer peer = (TextComponentPeer)this.peer;
    int position = 0;

    if (peer != null) {
        position = peer.getCaretPosition();
    } else {
        position = selectionStart;
    }
    int maxposition = getText().length();
    if (position > maxposition) {
        position = maxposition;
    }
    return position;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:27,代码来源:TextComponent.java

示例3: getCaretPosition

import java.awt.peer.TextComponentPeer; //导入方法依赖的package包/类
/**
    * Returns the position of the text insertion caret.
    * The caret position is constrained to be between 0
    * and the last character of the text, inclusive.
    * If the text or caret have not been set, the default
    * caret position is 0.
    *
    * @return       the position of the text insertion caret
    * @see #setCaretPosition(int)
    * @since        JDK1.1
    */
   public synchronized int getCaretPosition() {
       TextComponentPeer peer = (TextComponentPeer)this.peer;
int position = 0;

if (peer != null) {
    position = peer.getCaretPosition();
} else {
    position = selectionStart;
}
       int maxposition = getText().length();
       if (position > maxposition) {
           position = maxposition;
       }
       return position;
   }
 
开发者ID:jgaltidor,项目名称:VarJ,代码行数:27,代码来源:TextComponent.java

示例4: getCaretPosition

import java.awt.peer.TextComponentPeer; //导入方法依赖的package包/类
/**
 * Returns the current caret position in the text.
 *
 * @return The caret position in the text.
 */
public synchronized int getCaretPosition()
{
  TextComponentPeer tcp = (TextComponentPeer) getPeer();
  if (tcp != null)
    return(tcp.getCaretPosition());
  else
    return(0);
}
 
开发者ID:vilie,项目名称:javify,代码行数:14,代码来源:TextComponent.java


注:本文中的java.awt.peer.TextComponentPeer.getCaretPosition方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。