Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #6896

Re: event listener (how to)

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail
From Knute Johnson <september@knutejohnson.com>
Newsgroups comp.lang.java.programmer
Subject Re: event listener (how to)
Date Mon, 08 Aug 2011 21:27:38 -0700
Organization A noiseless patient Spider
Lines 17
Message-ID <j1qcv5$3n2$1@dont-email.me> (permalink)
References <e509c046-a524-4a27-ab4f-b6291ff1f331@glegroupsg2000goo.googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
Injection-Date Tue, 9 Aug 2011 04:27:17 +0000 (UTC)
Injection-Info mx04.eternal-september.org; posting-host="mz/LDSJwiWnk3Jnnqg7x+Q"; logging-data="3810"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18a5Oakcbfq6YtzdE1oINBl"
User-Agent Mozilla/5.0 (Windows NT 5.1; rv:5.0) Gecko/20110624 Thunderbird/5.0
In-Reply-To <e509c046-a524-4a27-ab4f-b6291ff1f331@glegroupsg2000goo.googlegroups.com>
Cancel-Lock sha1:f2nOLeBAQWVUybGNEoSj2WzS9ds=
Xref x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:6896

Show key headers only | View raw


On 8/8/2011 7:16 PM, wee wrote:
> hello,
>
> i added an actionListener to a JButton. it works well when i click it
> with a mouse. if i put the focus on the button using the tab key and
> press the keyboard enter key, nothing happens. my question then is,
> how can i make the JButton react to both mouse click and the keyboard
> enter key? do i need to add a keypressed listener on top of the
> actionListener? any help would be appreciated.
>
> thank you.

Look at JRootPane.setDefaultButton().

-- 

Knute Johnson

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Find similar


Thread

event listener (how to) wee <rbulseco@gmail.com> - 2011-08-08 19:16 -0700
  Re: event listener (how to) markspace <-@.> - 2011-08-08 20:06 -0700
  Re: event listener (how to) Knute Johnson <september@knutejohnson.com> - 2011-08-08 21:27 -0700

csiph-web