🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.jbuilder.java.swing
2 messages
2 total messages Started by Sam Seaborn Tue, 13 Apr 2004 21:09
JTable on key press jump to item alphabetically
#1032
Author: Sam Seaborn
Date: Tue, 13 Apr 2004 21:09
12 lines
1319 bytes
Hi,

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,

Sam
Re: JTable on key press jump to item alphabetically
#1035
Author: John McGrath [TeamB]
Date: Wed, 14 Apr 2004 03:12
25 lines
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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads