Now when I click inside the JEditorPane with my right mouse button, a mouse listener picks this up, which in turn has a pop up menu pop up. But now I want the pop up menu to have some extra options when I click on the picture.

My question is therefore: is there some way for me to find out if either the picture has been clicked, or the text around it?

I don't think getDeepestComponent will help as the image most likely is not a separate component.

Your JEditorPane has a StyledDocument which should be able to return you the image only using getCharacterElement. Now all you need to do is translate the mouse click into a position. That sounds easier than it is though, as I haven't found a way to do this yet.

Edit: and I may have found it. JTextComponent has method viewToModel that can convert a Point to an offset.