javax.swing.JEditorPane.getSelectionStart()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(5.2k)|赞(0)|评价(0)|浏览(200)

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

JEditorPane.getSelectionStart介绍

暂无

代码示例

代码示例来源: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: 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

if ( (ep.getSelectionStart () <= offset) &&
   (offset <= ep.getSelectionEnd ())
) {

代码示例来源: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 ();

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-debugger-jpda-js

if ( (ep.getSelectionStart () <= offset) &&
   (offset <= ep.getSelectionEnd ())
) {

代码示例来源: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 ();

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-debugger-jpda-projectsui

if ( (ep.getSelectionStart () <= offset) &&
   (offset <= ep.getSelectionEnd ())
) {

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-debugger-jpda-projects

if ( (ep.getSelectionStart () <= offset) &&
   (offset <= ep.getSelectionEnd ())
) {

代码示例来源:origin: eu.mihosoft.vrl/vrl

int selectionStart = Math.min(getEditor().getSelectionStart(),
    getEditor().getSelectionEnd());
int selectionEnd = Math.max(getEditor().getSelectionStart(),
    getEditor().getSelectionEnd());

代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-ui

int iStart = jepEditor.getSelectionStart();
int iEnd   = jepEditor.getSelectionEnd();
String selText = htmlDoc.getText(iStart, iEnd - iStart);

代码示例来源: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) {

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-debugger-jpda-projects

String s = ep.getSelectedText ();
currentOffset = ep.getCaretPosition();
if (ep.getSelectionStart() > currentOffset || ep.getSelectionEnd() < currentOffset) {

代码示例来源:origin: dcaoyuan/nbscala

String s = ep.getSelectedText();
currentOffset = ep.getCaretPosition();
if (ep.getSelectionStart() > currentOffset || ep.getSelectionEnd() < currentOffset) {

相关文章

JEditorPane类方法