javax.swing.text.Caret.moveDot()方法的使用及代码示例

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

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

Caret.moveDot介绍

暂无

代码示例

代码示例来源:origin: bobbylight/RSyntaxTextArea

caretPos = Math.min(caretPos+text.length(), curLineEnd-1);
caret.moveDot(caretPos);//moveCaretPosition(caretPos);

代码示例来源:origin: bobbylight/RSyntaxTextArea

caret.moveDot(dot);

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-editor

@Override
  protected void moveToNewOffset(JTextComponent textComponent, int offset) throws BadLocationException {
    textComponent.getCaret().moveDot(offset);
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-editor

@Override
  protected void moveToNewOffset(JTextComponent textComponent, int offset) {
    textComponent.getCaret().moveDot(offset);
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-gsf

protected @Override void moveToNewOffset(JTextComponent textComponent, int offset) throws BadLocationException {
    textComponent.getCaret().moveDot(offset);
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-gsf

protected @Override void moveToNewOffset(JTextComponent textComponent, int offset) throws BadLocationException {
    textComponent.getCaret().moveDot(offset);
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/org-netbeans-modules-editor-lib

public void actionPerformed(ActionEvent evt, JTextComponent target) {
    if (target != null) {
      Caret caret = target.getCaret();
      int dot = target.getDocument().getLength(); // end of document
      if (select) {
        caret.moveDot(dot);
      } else {
        caret.setDot(dot);
      }
    }
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/org-netbeans-modules-editor-lib

public void actionPerformed(ActionEvent evt, JTextComponent target) {
    if (target != null) {
      Caret caret = target.getCaret();
      int dot = 0; // begin of document
      if (select) {
        caret.moveDot(dot);
      } else {
        caret.setDot(dot);
      }
    }
  }
}

代码示例来源:origin: net.java.abeille/abeille

public void actionPerformed(ActionEvent evt, JTextComponent target) {
    if (target != null) {
      Caret caret = target.getCaret();
      int dot = 0; // begin of document
      if (select) {
        caret.moveDot(dot);
      }
      else {
        caret.setDot(dot);
      }
    }
  }
}

代码示例来源:origin: org.gosu-lang.gosu/gosu-editor

public static void selectLeft( JTextComponent editor )
{
 String source = GosuStringUtil.reverse( editor.getText() );
 int pos = source.length() - editor.getCaretPosition();
 pos = TextComponentUtil.getNextWordPostition( pos, source, true );
 if( pos != -1 )
 {
  editor.getCaret().moveDot( source.length() - pos );
 }
}

代码示例来源:origin: org.gosu-lang.gosu/gosu-lab

public static void selectLeft( JTextComponent editor )
{
 String source = GosuStringUtil.reverse( editor.getText() );
 int pos = source.length() - editor.getCaretPosition();
 pos = TextComponentUtil.getNextWordPostition( pos, source, true );
 if( pos != -1 )
 {
  editor.getCaret().moveDot( source.length() - pos );
 }
}

代码示例来源:origin: org.gosu-lang.gosu/gosu-lab

public static void selectRight( JTextComponent editor )
{
 String source = editor.getText();
 int pos = editor.getCaretPosition();
 pos = TextComponentUtil.getNextWordPostition( pos, source, false );
 if( pos != -1 )
 {
  editor.getCaret().moveDot( pos );
 }
}

代码示例来源:origin: org.gosu-lang.gosu/gosu-editor

public static void selectRight( JTextComponent editor )
{
 String source = editor.getText();
 int pos = editor.getCaretPosition();
 pos = TextComponentUtil.getNextWordPostition( pos, source, false );
 if( pos != -1 )
 {
  editor.getCaret().moveDot( pos );
 }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-visualweb-extension-openide

/**
 * called to restore the state of a component 
 * because a drop was not performed.
 */
protected void restoreComponentState(JComponent comp) {
  JTextComponent c = (JTextComponent) comp;
  Caret caret = c.getCaret();
  caret.setDot(mark);
  caret.moveDot(dot);
  caret.setVisible(visible);
}

代码示例来源:origin: org.gosu-lang.gosu/gosu-lab

public static void selectLineAtCaret( JTextComponent editor )
{
 int lineStart = getLineStart( editor.getText(), editor.getCaretPosition() );
 int lineEnd = getLineEnd( editor.getText(), editor.getCaretPosition() );
 if( lineEnd < editor.getText().length() )
 {
  lineEnd++;
 }
 editor.getCaret().setDot( lineEnd );
 editor.getCaret().moveDot( lineStart );
}

代码示例来源:origin: JGillam/burp-paramalyzer

@Override
  public void actionPerformed(ActionEvent e) {
    ParamInstance pi = paramListModel.getParamInstance(listValues.getSelectedIndex());
    if (pi != null) {
      Caret caret = textAreaRequest.getCaret();
      caret.setSelectionVisible(true);
      caret.setDot(pi.getValueStart());
      caret.moveDot(pi.getValueEnd());
    }
  }
});

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-editor

private void select(SelectionInfo selectionInfo) {
  Caret caret = target.getCaret();
  markIgnoreNextCaretUpdate();
  caret.setDot(selectionInfo.getStartOffset());
  markIgnoreNextCaretUpdate();
  caret.moveDot(selectionInfo.getEndOffset());
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-gsf

private void select(SelectionInfo selectionInfo) {
  Caret caret = target.getCaret();
  markIgnoreNextCaretUpdate();
  caret.setDot(selectionInfo.getStartOffset());
  markIgnoreNextCaretUpdate();
  caret.moveDot(selectionInfo.getEndOffset());
}

代码示例来源:origin: org.gosu-lang.gosu/gosu-lab

private void setSelection( Point point )
{
 Rectangle visibleRect = _gsEditor.getEditor().getVisibleRect();
 _gsEditor.getEditor().getCaret().setDot( point.x );
 _gsEditor.getEditor().getCaret().moveDot( point.y );
 _gsEditor.getEditor().scrollRectToVisible( visibleRect );
}

代码示例来源:origin: org.gosu-lang.gosu/gosu-editor

private void setSelection( Point point )
{
 Rectangle visibleRect = _gsEditor.getEditor().getVisibleRect();
 _gsEditor.getEditor().getCaret().setDot( point.x );
 _gsEditor.getEditor().getCaret().moveDot( point.y );
 _gsEditor.getEditor().scrollRectToVisible( visibleRect );
}

相关文章