 <p>Okay, so first of all you will need to implement the <code>MouseListener</code> interface. You can either have your main class implement <code>MouseListener</code>, or attach a generic implementation to a <code>JPanel</code> via <code>addMouseListener()</code>. The latter method is described below:</p> <pre><code>public class MyPanel extends JPanel { public MyPanel() { // ... this.addMouseListener(new MouseListener() { @Override public void mouseClicked(MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON1) { // Handle left-click } else if (e.getButton() == MouseEvent.BUTTON2) { // Handle right-click } } }); } } </code></pre> <p>You can also check <code>e.isShiftDown()</code> to see if the Shift key is being held.</p>