本文整理了Java中javax.swing.JTextArea.setSelectionEnd()
方法的一些代码示例,展示了JTextArea.setSelectionEnd()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTextArea.setSelectionEnd()
方法的具体详情如下:
包路径:javax.swing.JTextArea
类名称:JTextArea
方法名:setSelectionEnd
暂无
代码示例来源:origin: bobbylight/RSyntaxTextArea
textArea.setSelectionEnd(end);
if (select) {
textArea.setSelectionStart(start);
textArea.setSelectionEnd(end);
if (select) {
textArea.setSelectionStart(start);
textArea.setSelectionEnd(end);
代码示例来源:origin: triplea-game/triplea
private static void selectAll(final JTextArea textArea) {
textArea.setSelectionEnd(0);
textArea.setSelectionEnd(textArea.getText().length());
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-core
public void focusLost(java.awt.event.FocusEvent e) {
jta.setSelectionStart(0);
jta.setSelectionEnd(0);
}
});
代码示例来源:origin: org.netbeans.modules/org-netbeans-core
public void focusGained(java.awt.event.FocusEvent e) {
jta.setSelectionStart(0);
jta.setSelectionEnd(jta.getText().length());
}
public void focusLost(java.awt.event.FocusEvent e) {
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-visualweb-propertyeditors
public void focusLost(java.awt.event.FocusEvent e) {
jta.setSelectionStart(0);
jta.setSelectionEnd(0);
}
});
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-visualweb-propertyeditors
public void focusGained(java.awt.event.FocusEvent e) {
jta.setSelectionStart(0);
jta.setSelectionEnd(jta.getText().length());
}
代码示例来源:origin: pvto/konte-art
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
int ind = findNext(target.getCaretPosition(), false, findF.getText());
if (ind >= 0)
{
target.setCaretPosition(ind);
target.setSelectionStart(ind);
target.setSelectionEnd(end == ind ? ind + findF.getText().length()+1 : end);
}
else
{
target.setCaretPosition(0);
}
}//GEN-LAST:event_jButton1ActionPerformed
代码示例来源:origin: pvto/konte-art
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
int ind = findNext(target.getCaretPosition(), true, findF.getText());
if (ind >= 0)
{
target.setCaretPosition(ind);
target.setSelectionStart(ind);
target.setSelectionEnd(end);
}
else
{
target.setCaretPosition(0);
}
}//GEN-LAST:event_jButton2ActionPerformed
代码示例来源:origin: orbisgis/orbisgis
/**
* Block uncomment the selected text in the given script panel.
*
* @param scriptPanel Script panel
*/
private static void blockUncomment(JTextArea scriptPanel) {
// Recover the index of the start of the selection.
final int startOffset = scriptPanel.getSelectionStart();
final int endOffset = scriptPanel.getSelectionEnd();
// Delete the comment characters.
scriptPanel.replaceRange("", endOffset - BLOCK_COMMENT_END.length(), endOffset);
scriptPanel.replaceRange("", startOffset, startOffset + BLOCK_COMMENT_START.length());
// Select the uncommented selection.
scriptPanel.setSelectionStart(startOffset);
scriptPanel.setSelectionEnd(endOffset - BLOCK_COMMENT_START.length()
- BLOCK_COMMENT_END.length());
}
代码示例来源:origin: orbisgis/orbisgis
/**
* Block comment the selected text in the given script panel.
*
* @param scriptPanel Script panel
*/
private static void blockComment(JTextArea scriptPanel) {
// Recover the index of the start of the selection.
final int startOffset = scriptPanel.getSelectionStart();
// Comment the selection.
final String commentedSelection = BLOCK_COMMENT_START
+ scriptPanel.getSelectedText() + BLOCK_COMMENT_END;
scriptPanel.replaceSelection(commentedSelection);
// Select the commented selection.
scriptPanel.setSelectionStart(startOffset);
scriptPanel.setSelectionEnd(startOffset + commentedSelection.length());
}
代码示例来源:origin: com.google.code.findbugs/findbugs
protected void commentBoxClicked() {
if (commentWasChanged()) {
return;
}
setCanAddComments(false, true);
CommentInfo commentInfo = new CommentInfo().invoke();
boolean sameText = commentInfo.isSameText();
String txt = commentInfo.getTxt();
if (!sameText) {
txt = "";
}
if (txt == null || txt.trim().length() == 0) {
txt = "";
}
resetCommentBoxFont();
boolean sameTextInBox = commentBox.getText().equals(txt);
setCommentText(txt);
int start = commentBox.getSelectionStart();
int end = commentBox.getSelectionEnd();
if (!commentBox.hasFocus() && (!sameTextInBox || start != 0 || end != txt.length())) {
commentBox.setSelectionStart(0);
commentBox.setSelectionEnd(txt.length());
}
updateSaveButton();
}
代码示例来源:origin: com.fifesoft/rsyntaxtextarea
textArea.setSelectionEnd(end);
if (select) {
textArea.setSelectionStart(start);
textArea.setSelectionEnd(end);
if (select) {
textArea.setSelectionStart(start);
textArea.setSelectionEnd(end);
代码示例来源:origin: org.apache.uima/uimaj-tools
if (null != this.main.getCas().getDocumentText()) {
this.main.getTextArea().setSelectionStart(node.getStart());
this.main.getTextArea().setSelectionEnd(node.getEnd());
this.main.getTextArea().setSelectionEnd(currentSelStart);
内容来源于网络,如有侵权,请联系作者删除!