本文整理了Java中javax.swing.text.Caret.setSelectionVisible()
方法的一些代码示例,展示了Caret.setSelectionVisible()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Caret.setSelectionVisible()
方法的具体详情如下:
包路径:javax.swing.text.Caret
类名称:Caret
方法名:setSelectionVisible
暂无
代码示例来源:origin: ron190/jsql-injection
@Override
public void focusGained(FocusEvent arg0) {
DialogTranslate.this.textToTranslate[0].getCaret().setVisible(true);
DialogTranslate.this.textToTranslate[0].getCaret().setSelectionVisible(true);
}
});
代码示例来源:origin: ron190/jsql-injection
@Override
public void focusGained(FocusEvent arg0) {
browser.getCaret().setVisible(true);
browser.getCaret().setSelectionVisible(true);
}
});
代码示例来源:origin: ron190/jsql-injection
@Override
public void focusGained(FocusEvent arg0) {
text[0].getCaret().setVisible(true);
text[0].getCaret().setSelectionVisible(true);
}
});
代码示例来源:origin: ron190/jsql-injection
@Override
public void focusGained(FocusEvent arg0) {
JPopupTextPane.this.getProxy().getCaret().setVisible(true);
JPopupTextPane.this.getProxy().getCaret().setSelectionVisible(true);
}
});
代码示例来源:origin: ron190/jsql-injection
@Override
public void focusGained(FocusEvent arg0) {
JPopupTextArea.this.getProxy().getCaret().setVisible(true);
JPopupTextArea.this.getProxy().getCaret().setSelectionVisible(true);
}
});
代码示例来源:origin: ron190/jsql-injection
@Override
public void focusGained(FocusEvent arg0) {
JColoredConsole.this.getProxy().getCaret().setVisible(true);
JColoredConsole.this.getProxy().getCaret().setSelectionVisible(true);
}
});
代码示例来源:origin: bobbylight/RSyntaxTextArea
textArea.getCaret().setSelectionVisible(true);
代码示例来源:origin: bobbylight/RSyntaxTextArea
textArea.getCaret().setSelectionVisible(true);
if (forward && start>-1) {
result.getMatchRange().translate(start);
代码示例来源:origin: omegat-org/omegat
@Override
public void focusGained(FocusEvent e) {
Caret caret = comp.getCaret();
caret.setVisible(true);
caret.setSelectionVisible(true);
}
};
代码示例来源:origin: bobbylight/RSyntaxTextArea
c.setSelectionVisible(true);
代码示例来源:origin: Vhati/Slipstream-Mod-Manager
private void findNext() {
JTextArea currentArea = getCurrentArea();
if ( currentArea == null ) return;
String query = findField.getText();
if ( query.length() == 0 ) return;
Caret caret = currentArea.getCaret();
int from = Math.max( caret.getDot(), caret.getMark() );
Pattern ptn = Pattern.compile( "(?i)"+ Pattern.quote( query ) );
Matcher m = ptn.matcher( currentArea.getText() );
if ( m.find(from) ) {
caret.setDot( m.start() );
caret.moveDot( m.end() );
caret.setSelectionVisible( true );
}
}
代码示例来源:origin: org.codehaus.jtstand/jtstand-desktop
/**
* @param currentResult
* @param offset
* @return the start position of the selected text
*/
private int updateStateAfterFound(MatchResult currentResult, final int offset) {
int end = currentResult.end() + offset;
int found = currentResult.start() + offset;
select(found, end);
getCaret().setSelectionVisible(true);
lastFoundIndex = found;
lastMatchResult = currentResult;
lastRegEx = ((Matcher) lastMatchResult).pattern().pattern();
return found;
}
代码示例来源:origin: org.swinglabs.swingx/swingx-core
/**
* @param currentResult
* @param offset
* @return the start position of the selected text
*/
private int updateStateAfterFound(MatchResult currentResult, final int offset) {
int end = currentResult.end() + offset;
int found = currentResult.start() + offset;
select(found, end);
getCaret().setSelectionVisible(true);
lastFoundIndex = found;
lastMatchResult = currentResult;
lastRegEx = ((Matcher) lastMatchResult).pattern().pattern();
return found;
}
代码示例来源:origin: org.swinglabs.swingx/swingx-all
/**
* @param currentResult
* @param offset
* @return the start position of the selected text
*/
private int updateStateAfterFound(MatchResult currentResult, final int offset) {
int end = currentResult.end() + offset;
int found = currentResult.start() + offset;
select(found, end);
getCaret().setSelectionVisible(true);
lastFoundIndex = found;
lastMatchResult = currentResult;
lastRegEx = ((Matcher) lastMatchResult).pattern().pattern();
return found;
}
代码示例来源:origin: antlr/antlrworks
public void selectTextRange(int start, int end) {
textPane.setCaretPosition(start);
textPane.moveCaretPosition(end);
textPane.getCaret().setSelectionVisible(true);
scrollCenterToPosition(start, false);
}
代码示例来源:origin: org.bidib.jbidib.swinglabs.swingx/swingx-core
/**
* @param currentResult
* @param offset
* @return the start position of the selected text
*/
private int updateStateAfterFound(MatchResult currentResult, final int offset) {
int end = currentResult.end() + offset;
int found = currentResult.start() + offset;
select(found, end);
getCaret().setSelectionVisible(true);
lastFoundIndex = found;
lastMatchResult = currentResult;
lastRegEx = ((Matcher) lastMatchResult).pattern().pattern();
return found;
}
代码示例来源:origin: com.haulmont.thirdparty/swingx-core
/**
* @param currentResult
* @param offset
* @return the start position of the selected text
*/
private int updateStateAfterFound(MatchResult currentResult, final int offset) {
int end = currentResult.end() + offset;
int found = currentResult.start() + offset;
select(found, end);
getCaret().setSelectionVisible(true);
lastFoundIndex = found;
lastMatchResult = currentResult;
lastRegEx = ((Matcher) lastMatchResult).pattern().pattern();
return found;
}
代码示例来源: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: 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();
try {
if (caret.isSelectionVisible()) {
caret.setSelectionVisible(false); // unselect if anything selected
} else { // selection not visible
int block[] = Utilities.getIdentifierBlock((BaseDocument)target.getDocument(),
caret.getDot());
if (block != null) {
caret.setDot(block[0]);
caret.moveDot(block[1]);
}
}
} catch (BadLocationException e) {
target.getToolkit().beep();
}
}
}
}
代码示例来源:origin: de.sciss/abc4j
/** Highlights the specified element in the abc tune notation.
* @param elmnt The element to be highlighted in the abc tune notation. */
public void setSelectedItem(PositionableInCharStream elmnt) {
CharStreamPosition pos = null;
if (elmnt != null)
pos = elmnt.getCharStreamPosition();
if (pos != null) {
int begin = pos.getStartIndex();
int end = pos.getEndIndex();
try {
setCaretPosition(end);
moveCaretPosition(begin);
getCaret().setSelectionVisible(true);
repaint();
}
catch (IllegalArgumentException ignored)
{}
}
}
内容来源于网络,如有侵权,请联系作者删除!