If this is an applet, you wont need this because applet sizes are not dynamic. You specify the size inside html files.
If this was a jframe, i would suggest you to get the size of the frame, capture windowResized event, rescale the rectangle dimensions there and call repaint to redraw frame. But for applet i don't think there is a appletResized event.
