I want to draw a rectangle in a java application. I have used rectangle2d to draw a rectangle. I need the rectangle to vary size based on mouse drag. i.e. The size of the re
Check out Custom Painting Approaches for the two common ways to do painting:
The example show how to draw multiple Rectangles of any size and varying colors.