Article View: borland.public.jbuilder.java.swing
Article #640Re: JTextPane KeyEvent
From: John McGrath [TeamB]
Date: Fri, 01 Apr 2005 01:19
Date: Fri, 01 Apr 2005 01:19
33 lines
2537 bytes
2537 bytes
On 3/31/2005 at 6:02:44 PM, Aven wrote:
> Yes, I want to ensure that characters inserted are always inserted at
> the end of the document. Other behaviors are same as those of a normal
> JTextPane, i.e., I still want to reserve all Ctrl-C, Ctrl-V, ...,
> actions. How can I do that?
I do not think you have specified the desired behavior in the detail that
you need to. Should the characters inserted with a paste also get
inserted at the end? How does "cut" work? Does it delete text from the
middle of the buffer, or should this be disabled? What should happen with
the caret when some text is inserted? Does it stay where it was or does
it move to the end. Should cursor keys still move the caret?
The answer to these questions will have a significant effect on how this
might be implemented. For example, if you do not need caret movement,
then you could try forcing the caret to stay at the end of the text.
> My key listener somehow consumes the key event, so it prevents
> further processsing of the key event.
I can think of no reason this would happen, unless you explicitly call
consume() on the event. Of course, I have not seen what your key event
handled is doing, so it is impossible to know what it is doing.
--
Regards,
John McGrath [TeamB]
---------------------------------------------------
Before sending me e-mail, please read:
http://www.JPMcGrath.net/newsgroups/e-mail.html
Technical Details
Message-ID:
<xn0e0ezcp61kf63001@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news4.google.com!news.glorb.com!npeer.de.kpn-eurorings.net!news-FFM2.ecrc.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<424a7eeb$1@newsgroups.borland.com> <xn0e0dhxr4ianxy00l@newsgroups.borland.com> <424b4319$1@newsgroups.borland.com> <xn0e0e4pb4w2zzt00s@newsgroups.borland.com> <424c8099@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 111d45,128b4a821bddbb34 X-Google-Attributes: gid111d45,public X-Google-Language: ENGLISH,ASCII-7-bit From: "John McGrath [TeamB]" <ng-b@JPMcGrath.net> Subject: Re: JTextPane KeyEvent Newsgroups: borland.public.jbuilder.java.swing References: <424a7eeb$1@newsgroups.borland.com> <xn0e0dhxr4ianxy00l@newsgroups.borland.com> <424b4319$1@newsgroups.borland.com> <xn0e0e4pb4w2zzt00s@newsgroups.borland.com> <424c8099@newsgroups.borland.com> User-Agent: XanaNews/1.17.3.1 Message-ID: <xn0e0ezcp61kf63001@newsgroups.borland.com> X-Ref: newsgroups.borland.com ~XNS:00000347 MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 NNTP-Posting-Host: 141.158.33.210 Date: 31 Mar 2005 17:19:50 -0800 X-Trace: newsgroups.borland.com 1112318390 141.158.33.210 (31 Mar 2005 17:19:50 -0800) Lines: 33 X-Authenticated-User: jpmcgrath Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news4.google.com!news.glorb.com!npeer.de.kpn-eurorings.net!news-FFM2.ecrc.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail