• Post Reply Bookmark Topic Watch Topic
  • New Topic

Eventlisteners

 
kelly devon
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
i just want to know this to be sure
how many eventlisteners can u use per gui(eg actionlistener,mouselistener)?
that is to perform one action(like when u click on a yes button can u also or alternatively press enter ?) if yes pls howd u go about it
thx in advance
 
Pat Hays
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi kelly,

There are many eventlisteners you can use for your gui, depends on your needs.
Such as KeyListener, FocusListener, MouseWheelListener,....
You may download JFrameBuilder which is a easy to use Java GUI builder. After download and run it, you will know how to use various eventlisteners, and how these eventlisteners work immediately.

Cheers
 
kelly devon
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i meant can u use mouselistener and keyboardlistener @ the same
time? eg if a user keys in something he may want to use enter
im place of clicking ok and another may want to click ok instead of
pressing enter in the same application
thx
 
Sainath Veepuri
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Kelly,
We can add multiple listeners for a single component.

So in your case, just adding an actionlistener would solve your problem.

Thanks,
SAi.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!