Re: Plugin Development

Emilian Bold <[email protected]> Wed, 25 Oct 2017 12:40:34 +0300
Newsgroups gmane.comp.java.netbeans.devel
Message-ID <CAL6R17DyegG8_+kbxeC3YhDg9dPf+GKAMG08En90w4Xf22is7A@mail.gmail.com>
It's an one-liner but I can't give you an example now since I don't
remember the exact utils classes.

See
* http://wiki.netbeans.org/DevFaqGetOpenEditorWindows
* http://bits.netbeans.org/8.0/javadoc/org-openide-text/org/openide/text/NbDocument.html#findLineNumber(javax.swing.text.StyledDocument,
int)
* JEditorPane javadoc for getting the visible rectangle / lines

PS: Please use [email protected] , this mailing list will be closed soon.


--emi


On Tue, Oct 24, 2017 at 9:32 AM, DosBox <[email protected]> wrote:
> Hi all,
>
> I am trying to create a NetBeans plugin and I need to somehow find out the range of lines currently visible in the editor.
>
> Example: let say a opened file has 100 lines, editor displays 20 lines, scroll position is in the middle. I would like to find such functions that used like this:
>
>
> Code:
> int start = XXX.getVisibleLinesStart();
> int end   = XXX.getVisibleLinesEnd();
>
>
>
> should return:
>
>
> Code:
> start = 40;
> end   = 60;
>
>
>
> Is this possible to achieve with NetBeans API? Which component holds the information about document view? Where to look?
> I found out that it does not have to be lines, the first and last visible character would do.
>
>
>
>