How can I find the currently open document in the selected editor?

JTextComponent ed = org.netbeans.api.editor.EditorRegistry.lastFocusedComponent();
Document doc = ed.getDocument();
Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo