Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Swings  RSS feed

 
vandana remi
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
i am just gvg some snippets of code below.
pl. explain...
int modifiers = me.getModifiers();
if ((modifiers & InputEvent.BUTTON3_MASK)==InputEvent.BUTTON3_MASK)
{---
-------}

wht does ths modifiers do?
wht Do v use InputEvent for? how is it diff frm Actionevent?
wht is Masking used for?
thanx

 
Manfred Leonhardt
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Vandana,
Modifiers are things like control-key, shift-key, alt-key, etc. Buttons you usually hold down and hit another key that performs the action.
An action event happens because some component fires it. InputEvents happen because users have hit some key or mouse buttons. InputEvent should be used anytime you want to track key hit/release/type events or mouse clicks. In your little code snippet you are looking for mouse button 3 being clicked without any modifier keys being held down. This is probably because if a modifier was held down then another action would take place.
Masking is used to let you figure out which mouse button or key was hit by the user.
Regards,
Manfred.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!