Article View: borland.public.jbuilder.java.swing
Article #7847Re: Focus on a table cell
From: Tom Denn
Date: Wed, 03 Jan 2001 15:48
Date: Wed, 03 Jan 2001 15:48
30 lines
2157 bytes
2157 bytes
John, You said in an earlier post "table changes" concerning when to call stopCellEditing() on an editor..... " Of course, the problem is knowing when to do this . I wrestled with this for a while, and eventually came up with a solution I was happy with. I believe what I did was to override the focusLost() method for the TableCellEditor and call it from there." Now, your suggestion here to add listeners to the row and column selection models to detect the focus changes sounds like I would be creating some sort of TableFocusManager that's registered as a focusListener to these models. This manager would then call the currently active TableCellEditor's stopCellEditing() method when it detected that the focus was lost? Or am I just totally lost? I'd like to stop the active cell's editor when say the user clicked away from the table. I was able to do this by removing the cell editor when the user clicks in a different cell of the same table by calling Jtable.removeEditor() before bringing up the editor in the new cell by overriding JTable's editCellAt() method. But if I could perform this on the cell level, that would be best. Then no matter what, if the editor looses the focus, it would stop editing. Would my custom TableCellEditor be the FocusListener and stop itself? Thanks.
Technical Details
Message-ID:
<3a534901_1@dnews>Path:
arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!supernews.com!216.227.56.88.MISMATCH!telocity-west!TELOCITY!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!bornews.borland.com!dnews!137.225.250.2References:
<3a41e1cd_2@dnews> <MPG.14b498899ac43a53989def@forums.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,8c847dc85cebe1dc X-Google-Attributes: gid111d45,public X-Google-ArrivalTime: 2001-01-03 07:46:00 PST From: "Tom Denn" <dennt@jsc.mil> Newsgroups: borland.public.jbuilder.java.swing References: <3a41e1cd_2@dnews> <MPG.14b498899ac43a53989def@forums.borland.com> Subject: Re: Focus on a table cell Date: Wed, 3 Jan 2001 10:48:03 -0500 Lines: 33 X-Newsreader: Microsoft Outlook Express 4.72.3155.0 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3155.0 NNTP-Posting-Host: 137.225.250.2 Message-ID: <3a534901_1@dnews> X-Trace: 3 Jan 2001 07:45:05 -0800, 137.225.250.2 Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!supernews.com!216.227.56.88.MISMATCH!telocity-west!TELOCITY!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!bornews.borland.com!dnews!137.225.250.2