How can we draw the shapes in Java like we do in paint?
For example if I want to draw the rectangle this command will draw it:
g2.fill3DRect(mt, mf, 45, 45, true);
But how can I increase the or decrease the size of an object or shape during run-time using mouse like we did in paint?
Use a mouse listener to get the position of the mouse after it has been pressed. i.e.
But clear the screen by drawing a rectangle over the entire screen before each draw so that there’s not a million rectangles at the same time. This is the most basic example of course. Look into double buffering and practice.