javax.swing.text.StyledDocument.createPosition()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(2.7k)|赞(0)|评价(0)|浏览(115)

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

StyledDocument.createPosition介绍

暂无

代码示例

代码示例来源:origin: org.netbeans.api/org-openide-text

  1. public void run() {
  2. int offset = annoPos.getOffset();
  3. int lineStartOffset = doc.getParagraphElement(offset).getStartOffset();
  4. if (offset != lineStartOffset) { // not at line start -> correct
  5. try {
  6. annoPos = doc.createPosition(lineStartOffset);
  7. } catch (BadLocationException e) {
  8. throw new IllegalArgumentException(); // should never fail
  9. }
  10. }
  11. }

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

  1. public void run() {
  2. int offset = annoPos.getOffset();
  3. int lineStartOffset = doc.getParagraphElement(offset).getStartOffset();
  4. if (offset != lineStartOffset) { // not at line start -> correct
  5. try {
  6. annoPos = doc.createPosition(lineStartOffset);
  7. } catch (BadLocationException e) {
  8. throw new IllegalArgumentException(); // should never fail
  9. }
  10. }
  11. }

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

  1. public void run() {
  2. int offset = annoPos.getOffset();
  3. int lineStartOffset = doc.getParagraphElement(offset).getStartOffset();
  4. if (offset != lineStartOffset) { // not at line start -> correct
  5. try {
  6. annoPos = doc.createPosition(lineStartOffset);
  7. } catch (BadLocationException e) {
  8. throw new IllegalArgumentException(); // should never fail
  9. }
  10. }
  11. }

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-vmd-codegen

  1. public static SimpleSection createSimpleSectionAfter (StyledDocument document, GuardedSection sectionForAddingAfter, String sectionID) {
  2. GuardedSectionManager instance = GuardedSectionManager.getInstance (document);
  3. try {
  4. //TODO Logs, Remove it
  5. // System.out.println("-------------------------");
  6. // System.out.println("Section Name: " + sectionForAddingAfter.getName());
  7. // System.out.println("Start position: " + sectionForAddingAfter.getStartPosition());
  8. // System.out.println("Caret position: " + sectionForAddingAfter.getCaretPosition() );
  9. // System.out.println("Text: " + sectionForAddingAfter.getText());
  10. // System.out.println("--------------------------");
  11. return instance.createSimpleSection (document.createPosition (sectionForAddingAfter.getEndPosition ().getOffset () + 1), sectionID);
  12. } catch (BadLocationException e) {
  13. throw Debug.error (e);
  14. }
  15. }

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-languages

  1. indent -= IndentUtils.indentLevelSize (document);
  2. indent = Math.max (indent, 0);
  3. indentMap.put (document.createPosition (NbDocument.findLineOffset (document, ln)), indent);

代码示例来源:origin: AlexFalappa/nb-springboot

  1. Position pos = ed.getDocument().createPosition(caretPos);
  2. return new ChangeInfo(foPom, pos, pos);

相关文章