drawing a rectangle inside a label with a picture
Hi everyone,i want to know how you can draw a rectangle inside a label that have an iconimagethanks in advance,kimos
[144 byte] By [
Kimosa] at [2007-11-26 13:53:54]

# 1
It depends if you want it only to show on the GUI or really change the image inside the IconImage.
If you just want it to show in your GUI, extend JLabel and implement paintComponent to draw a rectangle on top.
JLabel label = new JLabel() {
protected void paintComponent(Graphics g) {
super.paintComponent(g);
g.drawRect(x, y, width, height);
}
};
# 2
its working, but this way i can not change the rectangle position and width and hight, now i draw it when the program start and i cant change it,is there a way to do it, in such a way that i can call paintcomonent to redraw it again with the new parms?