How do I overlay a JLabel image with text?
Posted on 2004-09-20
I am extending the JLabel class using the JLabel(ImageIcon imageicon) constructor.
What I would like to do is put text directly in the center of the label, directly overlaying the image itself.
I have tried code like the following, which does not seem to work:
public void paint(Graphics g)
g.drawString("some text", 5, 5);
the JLabel itself is about 20 x 20 so I would think that I would at least see something. Thanks in advance for any help.