本文整理了Java中javax.swing.text.StyledDocument.createPosition()
方法的一些代码示例,展示了StyledDocument.createPosition()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。StyledDocument.createPosition()
方法的具体详情如下:
包路径:javax.swing.text.StyledDocument
类名称:StyledDocument
方法名:createPosition
暂无
代码示例来源:origin: org.netbeans.api/org-openide-text
public void run() {
int offset = annoPos.getOffset();
int lineStartOffset = doc.getParagraphElement(offset).getStartOffset();
if (offset != lineStartOffset) { // not at line start -> correct
try {
annoPos = doc.createPosition(lineStartOffset);
} catch (BadLocationException e) {
throw new IllegalArgumentException(); // should never fail
}
}
}
代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide
public void run() {
int offset = annoPos.getOffset();
int lineStartOffset = doc.getParagraphElement(offset).getStartOffset();
if (offset != lineStartOffset) { // not at line start -> correct
try {
annoPos = doc.createPosition(lineStartOffset);
} catch (BadLocationException e) {
throw new IllegalArgumentException(); // should never fail
}
}
}
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide
public void run() {
int offset = annoPos.getOffset();
int lineStartOffset = doc.getParagraphElement(offset).getStartOffset();
if (offset != lineStartOffset) { // not at line start -> correct
try {
annoPos = doc.createPosition(lineStartOffset);
} catch (BadLocationException e) {
throw new IllegalArgumentException(); // should never fail
}
}
}
代码示例来源:origin: org.netbeans.api/org-netbeans-modules-vmd-codegen
public static SimpleSection createSimpleSectionAfter (StyledDocument document, GuardedSection sectionForAddingAfter, String sectionID) {
GuardedSectionManager instance = GuardedSectionManager.getInstance (document);
try {
//TODO Logs, Remove it
// System.out.println("-------------------------");
// System.out.println("Section Name: " + sectionForAddingAfter.getName());
// System.out.println("Start position: " + sectionForAddingAfter.getStartPosition());
// System.out.println("Caret position: " + sectionForAddingAfter.getCaretPosition() );
// System.out.println("Text: " + sectionForAddingAfter.getText());
// System.out.println("--------------------------");
return instance.createSimpleSection (document.createPosition (sectionForAddingAfter.getEndPosition ().getOffset () + 1), sectionID);
} catch (BadLocationException e) {
throw Debug.error (e);
}
}
代码示例来源:origin: org.netbeans.api/org-netbeans-modules-languages
indent -= IndentUtils.indentLevelSize (document);
indent = Math.max (indent, 0);
indentMap.put (document.createPosition (NbDocument.findLineOffset (document, ln)), indent);
代码示例来源:origin: AlexFalappa/nb-springboot
Position pos = ed.getDocument().createPosition(caretPos);
return new ChangeInfo(foPom, pos, pos);
内容来源于网络,如有侵权,请联系作者删除!