Article View: borland.public.jbuilder.java.swing
Article #7846Re: Cursor position in a JTextArea
From: Tobias Briel
Date: Thu, 30 Nov 2000 00:00
Date: Thu, 30 Nov 2000 00:00
24 lines
1364 bytes
1364 bytes
Hi John, that solved the problem. Thanks so much for your help! Tobias. John McGrath [TeamB] wrote: > On 29 Nov 2000 23:35:00 GMT, Joi Ellis [TeamB] wrote: > > >>> does anybody know, how to get the current cursor >>> position within a JTextArea or JTextField? >> >> I think you want to look at the underlying document object. > > > I don't think the Document maintains a position. > > The "cursor" is called a "caret" in the Swing text package. You can > get the caret position for any JTextComponent (including JTextArea and > JTextField) with the getCaretPosition() method.
Technical Details
Message-ID:
<3A267A10.1090909@franke.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<3A258C30.8070909@franke.com> <9043r4$4qu9@bornews.inprise.com> <MPG.148feabe8c640694989d7a@forums.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,cb649420cdff04f3 X-Google-Attributes: gid111d45,public From: Tobias Briel <Tobias.Briel@franke.com> Subject: Re: Cursor position in a JTextArea Date: 2000/11/30 Message-ID: <3A267A10.1090909@franke.com> X-Deja-AN: 699561563 Content-Transfer-Encoding: 7bit References: <3A258C30.8070909@franke.com> <9043r4$4qu9@bornews.inprise.com> <MPG.148feabe8c640694989d7a@forums.borland.com> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii; format=flowed X-Trace: 30 Nov 2000 08:02:36 -0800, 12.27.228.66 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; m18) Gecko/20001108 Netscape6/6.0 Newsgroups: borland.public.jbuilder.java.swing