You may want to focus only on the click, as that is the defining event. Shift is a modifier key. When you have your MouseEvent me, do me.isShiftDown()
http://docs.oracle.com/javase/6/docs/api/java/awt/event/InputEvent.html
So I guess that would be something like
public void mousePressed(MouseEvent me) {
if (me.isShiftDown()) {
// Do the function
}
}
Assuming you have some random object, for example a button, that can register clicks:
JButton button = new JButton("I'm a button!");
button.addMouseListener(new MouseListener() {
public void mousePressed(MouseEvent me) {
if (me.isShiftDown()) {
// Do the function
}
}
});
Now, whenever the button is clicked, your program will automatically check to see if the shift key is pressed, and if so, execute your function.