Java 如何在netbeans编辑器中获取当前行号
如何获取NetBeans编辑器中插入符号所在的行号。我正在开发一个net bean插件,需要获取插入符号(而不是鼠标)的位置。从您使用的编辑器cookie中获取当前窗格,例如:Java 如何在netbeans编辑器中获取当前行号,java,editor,netbeans-platform,Java,Editor,Netbeans Platform,如何获取NetBeans编辑器中插入符号所在的行号。我正在开发一个net bean插件,需要获取插入符号(而不是鼠标)的位置。从您使用的编辑器cookie中获取当前窗格,例如: try { StyledDocument doc = editorCookie.openDocument(); if (editorCookie != null) { JEditorPane[] panes = editorCookie.getOpenedPanes()
try {
StyledDocument doc = editorCookie.openDocument();
if (editorCookie != null) {
JEditorPane[] panes = editorCookie.getOpenedPanes();
if (panes.length > 0) {
int linenumber = panes[0].getCaret().getDot();
doc.insertString( linenumber, "emagenio.com", null );
}
}
关于@tmmg实际问题是什么?