本文整理了Java中javax.swing.JEditorPane.getSelectionEnd()
方法的一些代码示例,展示了JEditorPane.getSelectionEnd()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JEditorPane.getSelectionEnd()
方法的具体详情如下:
包路径:javax.swing.JEditorPane
类名称:JEditorPane
方法名:getSelectionEnd
暂无
代码示例来源:origin: freeplane/freeplane
@Override
protected JPopupMenu createPopupMenu(Component component) {
JPopupMenu menu = super.createPopupMenu(component);
JMenu formatMenu = new JMenu(TextUtils.getText("simplyhtml.formatLabel"));
menu.add(formatMenu);
if (textfield.getSelectionStart() == textfield.getSelectionEnd()){
formatMenu.setEnabled(false);
return menu;
}
formatMenu.add(boldAction);
formatMenu.add(italicAction);
formatMenu.add(underlineAction);
formatMenu.add(redAction);
formatMenu.add(greenAction);
formatMenu.add(blueAction);
formatMenu.add(blackAction);
formatMenu.add(defaultColorAction);
formatMenu.add(removeFormattingAction);
return menu;
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-debugger-common2
private static String getSelectedExpr(JEditorPane ep, int offset) {
if ((ep.getSelectionStart() <= offset) && (offset <= ep.getSelectionEnd())) {
return ep.getSelectedText();
}
return null;
}
代码示例来源:origin: eu.mihosoft.vrl/vrl
private boolean isSelected() {
int selectionStart = Math.min(getEditor().getSelectionStart(),
getEditor().getSelectionEnd());
int selectionEnd = Math.max(getEditor().getSelectionStart(),
getEditor().getSelectionEnd());
return selectionStart != selectionEnd;
}
代码示例来源: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: com.fifesoft/autocomplete
/**
* Copies from the description text area, if it is visible and there is
* a selection.
*
* @return Whether a copy occurred.
*/
public boolean copy() {
if (isVisible() &&
descArea.getSelectionStart()!=descArea.getSelectionEnd()) {
descArea.copy();
return true;
}
return false;
}
代码示例来源:origin: eu.mihosoft.vrl/vrl
private void removeSelection() {
try {
int selectionStart = Math.min(getEditor().getSelectionStart(),
getEditor().getSelectionEnd());
int selectionEnd = Math.max(getEditor().getSelectionStart(),
getEditor().getSelectionEnd());
getEditor().getDocument().remove(selectionStart, selectionEnd);
} catch (BadLocationException ex) {
// Logger.getLogger(ShellView.class.getName()).
// log(Level.SEVERE, null, ex);
}
}
代码示例来源:origin: freeplane/freeplane
public void actionPerformed(ActionEvent e) {
final JEditorPane editor = getEditor(e);
if(editor == null){
return;
}
final int selectionStart = editor.getSelectionStart();
final int selectionEnd = editor.getSelectionEnd();
if(selectionStart == selectionEnd){
return;
}
SHTMLEditorKit.removeCharacterAttributes((StyledDocument) editor.getDocument(), attribute, selectionStart, selectionEnd - selectionStart);
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-javascript2-debug-ui
(offset <= ep.getSelectionEnd ())
) {
t = ep.getSelectedText ();
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-debug
public static String getELIdentifier(StyledDocument doc, JEditorPane ep, int offset) {
String t = null;
if ( (ep.getSelectionStart () <= offset) &&
(offset <= ep.getSelectionEnd ())
) t = ep.getSelectedText ();
if (t != null) {
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-completion
@Override
public CsmReference findReference(Node activatedNode) {
assert activatedNode != null : "activatedNode must be not null";
EditorCookie cookie = activatedNode.getCookie(EditorCookie.class);
if (cookie != null) {
JEditorPane pane = CsmUtilities.findRecentEditorPaneInEQ(cookie);
if (pane != null) {
//System.err.printf("caret: %d, %d, %d\n",panes[0].getCaretPosition(), panes[0].getSelectionStart(), panes[0].getSelectionEnd());
int offset = pane.getSelectionEnd();
StyledDocument doc = CsmUtilities.openDocument(cookie);
return findReferenceInDoc(doc, offset);
}
}
return null;
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-debugger-jpda-js
(offset <= ep.getSelectionEnd ())
) {
t = ep.getSelectedText ();
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-debug
public static String getJavaIdentifier(StyledDocument doc, JEditorPane ep, int offset) {
String t = null;
if ( (ep.getSelectionStart() <= offset) && (offset <= ep.getSelectionEnd())) {
t = ep.getSelectedText();
代码示例来源:origin: dcaoyuan/nbscala
String t = null;
if ( (ep.getSelectionStart () <= offset) &&
(offset <= ep.getSelectionEnd ())
) t = ep.getSelectedText ();
if (t != null) return t;
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-debugger-jpda-projectsui
(offset <= ep.getSelectionEnd ())
) {
t = ep.getSelectedText ();
代码示例来源:origin: eu.mihosoft.vrl/vrl
getEditor().getSelectionEnd());
getEditor().getSelectionEnd());
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-debugger-jpda-projects
(offset <= ep.getSelectionEnd ())
) {
t = ep.getSelectedText ();
代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-ui
HTMLDocument htmlDoc = (HTMLDocument)(jepEditor.getDocument());
int iStart = jepEditor.getSelectionStart();
int iEnd = jepEditor.getSelectionEnd();
String selText = htmlDoc.getText(iStart, iEnd - iStart);
StringBuffer sbNew = new StringBuffer();
代码示例来源:origin: org.gosu-lang.gosu/gosu-lab
if( !editor.hasFocus() || editor.getSelectionStart() != editor.getSelectionEnd() )
代码示例来源:origin: org.gosu-lang.gosu/gosu-editor
if( !editor.hasFocus() || editor.getSelectionStart() != editor.getSelectionEnd() )
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-debugger-jpda-projectsui
s = ep.getSelectedText ();
currentOffset = ep.getCaretPosition();
if (ep.getSelectionStart() > currentOffset || ep.getSelectionEnd() < currentOffset) {
内容来源于网络,如有侵权,请联系作者删除!