javax.swing.JTextPane.setSelectionEnd()方法的使用及代码示例

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

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

JTextPane.setSelectionEnd介绍

暂无

代码示例

代码示例来源:origin: ron190/jsql-injection

this.bruteForceManager.getResult().setSelectionEnd(selectionEnd);

代码示例来源:origin: atdl4j/atdl4j

protected void setStrategyDescriptionText(String aText) {
 if (strategyDescription != null) {
  String newText = aText.replaceAll("'", "'");
  String htmlText = "<html><body face=\"arial\">" + newText + "</body></html>";
  strategyDescription.setText(htmlText);
  strategyDescription.setSelectionStart(0);
  strategyDescription.setSelectionEnd(0);
 }
}

代码示例来源:origin: net.imagej/imagej-ui-swing

public static JTextPane scrolledText(final int width, final int height,
  final String text, final DocumentListener listener, final Container addTo)
{
  final JTextPane component = new JTextPane();
  component.getDocument().addDocumentListener(listener);
  if (text != null) component.setText(text);
  component.setSelectionStart(0);
  component.setSelectionEnd(0);
  scrollPane(component, width, height, addTo);
  return component;
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-kenai-ui

protected void setEndSelection() {
  inbox.setSelectionStart(inbox.getDocument().getLength());
  inbox.setSelectionEnd(inbox.getDocument().getLength());
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-kenai-ui

public void actionPerformed(ActionEvent e) {
    String outText = "FILE:foo/bar/Test.java:23"; // NOI18N
    try {
      out.requestFocus();
      int caretPosition = out.getCaretPosition();
      out.getDocument().insertString( caretPosition, " " + outText + " ", null); // NOI18N
      out.setSelectionStart(caretPosition+6);
      out.setSelectionEnd(caretPosition+outText.length()+1);
    } catch (BadLocationException ex) {
      Exceptions.printStackTrace(ex);
    }
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-kenai-ui

public void actionPerformed(ActionEvent e) {
    String outText = "ISSUE:123";//NOI18N
    try {
      out.requestFocus();
      int caretPosition = out.getCaretPosition();
      out.getDocument().insertString( caretPosition, " " + outText + " ", null); // NOI18N
      out.setSelectionStart(caretPosition+7);
      out.setSelectionEnd(caretPosition+outText.length()+1);
    } catch (BadLocationException ex) {
      Exceptions.printStackTrace(ex);
    }
  }
}

代码示例来源:origin: com.davidbracewell/hermes-core

private void autoExpandSelection() {
 int start = editorPane.getSelectionStart();
 int end = editorPane.getSelectionEnd();
 String txt = editorPane.getText();
 while (start > 0 && !Character.isWhitespace(txt.charAt(start - 1)) && !StringUtils.isPunctuation(
   txt.charAt(start - 1))) {
   start--;
 }
 while (start < end && Character.isWhitespace(txt.charAt(start))) {
   start++;
 }
 while (end < txt.length() && !Character.isWhitespace(txt.charAt(end)) && !StringUtils.isPunctuation(
   txt.charAt(end))) {
   end++;
 }
 while (end > start && Character.isWhitespace(txt.charAt(end - 1))) {
   end--;
 }
 if (start == end) {
   return;
 }
 editorPane.setSelectionEnd(end);
 editorPane.setSelectionStart(start);
}

代码示例来源:origin: com.davidbracewell/hermes-core

if (row >= 0) {
 editorPane.setSelectionStart(annotationTableModel.getStart(row));
 editorPane.setSelectionEnd(annotationTableModel.getEnd(row));

代码示例来源:origin: stackoverflow.com

textArea.setSelectionEnd (iEndSel);

代码示例来源:origin: org.apache.uima/uimaj-tools

annotationTextPane.setSelectionEnd(0);

代码示例来源:origin: com.davidbracewell/hermes-core

private void syncEditorSelection(MouseEvent e) {
 if (e.isPopupTrigger()) {
   return;
 }
 int start = editorPane.getSelectionStart();
 int end = editorPane.getSelectionEnd();
 boolean isSelection = (end > start);
 if (!isSelection) {
   end++;
 }
 if (start >= 0) {
   int modelRow = annotationTableModel.find(start, end);
   if (modelRow < 0) {
    return;
   }
   int viewRow = annotationTable.getRowSorter().convertRowIndexToView(modelRow);
   annotationTable.getSelectionModel().setSelectionInterval(viewRow, viewRow);
   editorPane.setSelectionStart(annotationTableModel.getStart(modelRow));
   editorPane.setSelectionEnd(annotationTableModel.getEnd(modelRow));
 }
}

相关文章

JTextPane类方法