I search through this forum but I can't find a good explanation on this topic. Is there any different from the below statements? Which way is the better way to trigger this event?
if (evt.getButton() == 3)
Vs.
if (SwingUtilities.isRightMouseButton(evt))
SwingUtilities.isRightMouseButton(evt)
this uses a bit operand to compare:
while other, just compare with a magic number that can change, I would rather change first comparison to:
SwingUtilities is part of the javax which comes with jdk, so I would prefer to delegate that responsabillity to this utility (helper) class, so in that case, SwingUtilities wins.