Article View: borland.public.jbuilder.java.swing
Article #1035Re: JTable on key press jump to item alphabetically
From: John McGrath [TeamB]
Date: Wed, 14 Apr 2004 03:12
Date: Wed, 14 Apr 2004 03:12
25 lines
1808 bytes
1808 bytes
On 4/13/2004 at 5:09:07 PM, Sam Seaborn wrote:
> I have a JTable that lists a bunch of users. Is there a way to have the
> JTable selection jump to an item alphabetically based on a key press?
>
> That is, if I open the Windows file explorer to c:/windows and press
> 'G', it selects "Gone Fishing.bmp" because it's the first file that
> starts with G.
>
> Is there a simple way to get JTable to do this? Any help is greatly
> appreciated,
If you are asking whether there is a simple property you can set to make
it behave this way, the answer is "no", but it is not hard to implement.
Add a KeyListener to the JTable and set the selection in the keyTyped()
method.
--
Regards,
John McGrath [TeamB]
---------------------------------------------------
Before sending me e-mail, please read:
http://www.JPMcGrath.net/newsgroups/e-mail.html
Technical Details
Message-ID:
<407c9e1d$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<407c55a4$2@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,2ef24a82608cc8dd X-Google-Attributes: gid111d45,public X-Google-ArrivalTime: 2004-04-13 19:39:32 PST From: "John McGrath [TeamB]" <ng-b@JPMcGrath.net> Subject: Re: JTable on key press jump to item alphabetically Newsgroups: borland.public.jbuilder.java.swing References: <407c55a4$2@newsgroups.borland.com> User-Agent: XanaNews/1.16.2.2 MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 NNTP-Posting-Host: 151.197.30.87 Message-ID: <407c9e1d$1@newsgroups.borland.com> Date: 13 Apr 2004 19:12:45 -0800 X-Trace: newsgroups.borland.com 1081908765 151.197.30.87 (13 Apr 2004 19:12:45 -0800) Lines: 25 X-Authenticated-User: jpmcgrath Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail