I am making the GUI of yugioh game ana I want to summon monster with left click and set monster with right click how could I make that in a simple way ?
1 Answer
If you're using Swing, this is probably what you'll need: Mouse Listeners Once you've got your Swing elements on the page, take the one you want to respond to mouse events (I imagine that's play area?), and write a MouseAdapter class which handles the input to call your game logic for "set monster" and "summon monster". This answer then explains how to distinguish left- and right-clicks.
Please be aware though, there's a huge amount of work you'll need to do before you should be worrying about handling user input. Prototyping is sensible, but it's a very good idea to design your data model and game logic before you start writing the UI.