+1 to @aymeric's comment.
How about having two different JLabels
However, I understand why you can hesitate.
negative: requires 2 tags.
My smart (: P) solution for this is to create your own abstract component that takes the icon and text as parameters for the constructor - by expanding the JPanel and adding 2 JLabel to the JPanel , each label has it on the MouseAdapter , which calls the abstract method xxxClicked() (thus, any implementing class must override these methods).
Here is an example I made:

import java.awt.FlowLayout; import java.awt.Image; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.net.URL; import javax.imageio.ImageIO; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.SwingUtilities; public class Test { public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); ImageIcon ii = null; try {
David Kroukamp
source share