There is a way to do this by using java.awt.font.TextAttribute and java.util.Map. This way you won't need a MouseListener. The general form, I believe would be like this:



Map<TextAttribute,...