Article View: borland.public.jbuilder.java.swing
Article #7596Re: ENTER => jump to next field + shortcuts
From: Jeroen Ferdinandus
Date: Mon, 22 Jan 2001 15:26
Date: Mon, 22 Jan 2001 15:26
28 lines
2110 bytes
2110 bytes
First of all you need to detect the enter stroke this can be done ith either the keypressed event of the textboxes or with the actionperformed event. In that event you can then have the code move the cursor to the next textfield. Use the requestFocus method for this. Out of the api from JComponent : requestFocus public void requestFocus() Sets focus on the receiving component if isRequestFocusEnabled returns true and the component doesn't already have focus. Hope this can solve your first problem. "Edilmar Alves" <edilmar@intersite.com.br> wrote in message news:3A6C3C89.8A891BD1@intersite.com.br... > I'm new into Applets and I'm using JB3.5 C/S + JDK 1.3 SUN. > Then, I have wrote an applet that has many JTextFields and JButtons > to Insert/Delete/Update line data into a text file. > > My doubts are: > 1) How to write a code that allows ENTER key be used to change to > the next TextField, and, when I'm into last TextField, go to first, not > to next JButton. > 2) How to create shortcuts, like "Ins" to Insert button, "Del" to Delete, > "Ctrl+Enter" to Update, etc... > > >
Technical Details
Message-ID:
<3a6c5117$0$37179$1a0eedbc@dreader2.news.xs4all.nl>Path:
arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!supernews.com!nntp-relay.ihug.net!ihug.co.nz!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!news.tele.dk!194.165.93.117!newsfeed.wirehub.nl!transit.news.xs4all.nl!newszilla.xs4all.nl!not-for-mailReferences:
<3A6C3C89.8A891BD1@intersite.com.br>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,59b3f13d26c0b55b X-Google-Attributes: gid111d45,public X-Google-ArrivalTime: 2001-01-22 07:26:16 PST Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!supernews.com!nntp-relay.ihug.net!ihug.co.nz!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!news.tele.dk!194.165.93.117!newsfeed.wirehub.nl!transit.news.xs4all.nl!newszilla.xs4all.nl!not-for-mail From: "Jeroen Ferdinandus" <ferdinandus@medv.nl> Newsgroups: borland.public.jbuilder.java.swing References: <3A6C3C89.8A891BD1@intersite.com.br> Subject: Re: ENTER => jump to next field + shortcuts Date: Mon, 22 Jan 2001 16:26:14 +0100 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Lines: 30 Message-ID: <3a6c5117$0$37179$1a0eedbc@dreader2.news.xs4all.nl> NNTP-Posting-Host: 217.17.136.7 X-Trace: 980177175 dreader2.news.xs4all.nl 37179 medv/217.17.136.7