本文整理了Java中javax.swing.JEditorPane.setSelectionEnd()
方法的一些代码示例,展示了JEditorPane.setSelectionEnd()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JEditorPane.setSelectionEnd()
方法的具体详情如下:
包路径:javax.swing.JEditorPane
类名称:JEditorPane
方法名:setSelectionEnd
暂无
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-visualweb-propertyeditors
public void focusLost(java.awt.event.FocusEvent e) {
editorPane.setSelectionStart(0);
editorPane.setSelectionEnd(0);
}
});
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-visualweb-propertyeditors
public void focusGained(java.awt.event.FocusEvent e) {
editorPane.setSelectionStart(0);
editorPane.setSelectionEnd(editorPane.getText().length());
}
代码示例来源:origin: JetBrains/jediterm
@Override
public void focusLost(FocusEvent e) {
if (myEditorPane == null) return;
int caretPosition = myEditorPane.getCaretPosition();
myEditorPane.setSelectionStart(caretPosition);
myEditorPane.setSelectionEnd(caretPosition);
}
});
代码示例来源:origin: robo-code/robocode
public void findNext() {
EditWindow currentWindow = editor.getActiveWindow();
if (currentWindow == null || getFindTextField().getText().length() == 0) {
// launch error dialog?
return;
}
Pattern p = getCurrentPattern();
JEditorPane editorPane = currentWindow.getEditorPane();
// for some reason, getText() trims off \r but the indexes in
// the editor pane don't.
String text = editorPane.getText().replaceAll("\\r", "");
Matcher m = p.matcher(text);
int index = editorPane.getSelectionEnd();
if (!(m.find(index) || m.find())) {
return;
}
editorPane.setSelectionStart(m.start());
editorPane.setSelectionEnd(m.end());
}
代码示例来源:origin: org.netbeans.api/org-netbeans-modules-mobility-svgcore
@SuppressWarnings({"deprecation"})
public void run() {
EditorCookie ed = svgDoj.getCookie(EditorCookie.class);
try {
if (ed != null) {
ed.openDocument();
JEditorPane [] opened = ed.getOpenedPanes();
if ( opened != null && opened.length > 0) {
final JEditorPane pane = opened[0];
pane.setSelectionStart(position);
pane.setSelectionEnd(position);
if ( requestFocus) {
TopComponent tc = (TopComponent) SwingUtilities.getAncestorOfClass( TopComponent.class, pane);
if (tc != null) {
tc.requestActive();
// the requestActive itself does not work
tc.requestFocus();
}
}
}
}
} catch( Exception e) {
SceneManager.error("Select in editor failed.", e); //NOI18N
}
}
});
内容来源于网络,如有侵权,请联系作者删除!