Article View: borland.public.jbuilder.java.swing
Article #1788Re: JTable & Key event
From: John McGrath [TeamB]
Date: Wed, 23 Jul 2003 00:33
Date: Wed, 23 Jul 2003 00:33
28 lines
2151 bytes
2151 bytes
On 7/22/2003 at 9:13:11 AM, Erwin wrote: > I want to response to key event myself. On itself no problem. I wrote > my own JTable with its processKeyEvent(KeyEvent e) method in wich I > reactie to the key event (in this case to ENTER). This works as long > as I have selected a cell (you see that the cell is selected, but > there's no cursor). But when I click to go into the cell (now the > cursor is visible in the cell) and I press ENTER first the key event > of Component is done. After he has done the event of component he > goes into my processKeyEvent(KeyEvent e) and does what is written > there. But because he allready performed the actions of the key event > in Component, the result is not what I wanted. > > Can I prevent the key event of component from being processed??? What you describe as going into the cell, what happens is that a TableCellEditor has been created for the cell. This is a different component and it has the keyboard focus, so the key events are not being delivered to the JTable. Given that you have subclasses JTable, you should be able to add a key to the TableCellEditor when it is created. If you do that, do not forget to remove it when the editor closes. -- Regards, John McGrath [TeamB]
Technical Details
Message-ID:
<3f1dd7f6$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeed.online.be!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<3f1d37cb$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,7c0cdb9e1204a686 X-Google-Attributes: gid111d45,public X-Google-ArrivalTime: 2003-07-22 17:39:51 PST From: "John McGrath [TeamB]" <ng-b@jpmcgrath.net> Subject: Re: JTable & Key event Newsgroups: borland.public.jbuilder.java.swing References: <3f1d37cb$1@newsgroups.borland.com> User-Agent: XanaNews/1.15.3.1 MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 NNTP-Posting-Host: 151.197.210.86 Message-ID: <3f1dd7f6$1@newsgroups.borland.com> Date: 22 Jul 2003 17:33:58 -0700 X-Trace: newsgroups.borland.com 1058920438 151.197.210.86 (22 Jul 2003 17:33:58 -0700) Lines: 28 X-Authenticated-User: jpmcgrath Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeed.online.be!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail