In the program directions, we are told that MouseEvent.BUTTON1 is for a left click and MouseEvent.BUTTON3 is for a right click. So you check if your source is equal to MouseEvent.BUTTON1 or MouseEvent.BUTTON3. So you use event.getButton() to get the source.