🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #11969

Re: Selections in JEditorPane programmatically driven

#11969
From: C. Callaway
Date: Mon, 22 Mar 1999 00:00
18 lines
1507 bytes
Assuming you're using Swing, you need to use the setCaretPosition(int x)
method to move the cursor to the start of the selection, then call
moveCaretPosition(int x) to move the caret position to the end of the
selection. These are JTextComponent methods, so they should work for HTML as
well (havn't tested that). If you're using AWT, then use the select(int
start, int end) method.

Hope this helps!

Michael Mitiaguin <michael@digerati.com.au> wrote in message
news:36F57B2E.891D6D21@digerati.com.au...
> It is clear how to select a particular fragment of text . Can't figure
> out how to implement automatic scrolling to make a selection visible.
> Sort of conventional search CTRL+F to find and highlight something in
> window and then pressing F3
> ( or whatever )  brings next hit.  Would it be possible to do the same
> for HTML including pictures( I mean how to calculate an offset for
> particular text selection ).
Technical Details
Message-ID: <7d6bot$jgi1@forums.borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <36F57B2E.891D6D21@digerati.com.au>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,188c8f8234151d6e
X-Google-Attributes: gid111d45,public
From: "C. Callaway" <cqcallaw@iname.com>
Subject: Re: Selections in JEditorPane programmatically driven
Date: 1999/03/22
Message-ID: <7d6bot$jgi1@forums.borland.com>
X-Deja-AN: 457706973
References: <36F57B2E.891D6D21@digerati.com.au>
X-Priority: 3
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211
Organization: Another Netscape Collabra Server User
X-MSMail-Priority: Normal
Newsgroups: borland.public.jbuilder.java.swing