i modified my code as follows.
but now the rectangle is visible on the applet only after i release my mouse. but now i am able to draw multiple rectangles. the only problem is i can not see the rectangle while dragging the mouse.
Code:
import java.applet.*; import java.awt.*; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Graphics; import java.awt.Image; import java.awt.event.MouseEvent;
Leave a comment: