Article View: borland.public.jbuilder.java.language
Article #18696Re: keyboard return
From: Greg Hamer
Date: Tue, 19 May 1998 00:00
Date: Tue, 19 May 1998 00:00
24 lines
1590 bytes
1590 bytes
you can put it in the addNotify method after calling super.addNotify() - that way you dont have the overhead of requesting focus in each paint call. But once the ok button looses focus for any reason, then the enter key will not do anything. The only way I know around that is to have the frame add a keyboard listener to all the components that are on the frame that do not do anything special with the Enter key Oyvind L Johansen wrote: > Actually I figured out the main problem was to get the focus to the ok > button. This doesen't work if you put requestFocus() in the constructor > (since the button has to be displayed before it requests focus I think). I > solved this by putting requestFocus() in the paint method. Any other ideas? > > Oyvind L Johansen wrote in message <6jnq9b$k3717@forums.borland.com>... > >I have a frame with ok and cancel buttons on, and want pressing return on > >the keyboard do the same as pressing the ok button. > > > >What is the best way to accomplish this?
Technical Details
Message-ID:
<35620601.8F818A94@corp.borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<6jnq9b$k3717@forums.borland.com> <6jpg4f$lpe5@forums.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,84750e30c7c506c5 X-Google-Attributes: gidf74b3,public From: Greg Hamer <ghamer@corp.borland.com> Subject: Re: keyboard return Date: 1998/05/19 Message-ID: <35620601.8F818A94@corp.borland.com> X-Deja-AN: 354757097 Content-Transfer-Encoding: 7bit References: <6jnq9b$k3717@forums.borland.com> <6jpg4f$lpe5@forums.borland.com> Content-Type: text/plain; charset=us-ascii Organization: Another Netscape Collabra Server User Mime-Version: 1.0 Newsgroups: borland.public.jbuilder.java.language