954,536 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

In java applet how do allow a user to click a rectangle and draw another rectangle.

I want in java applet if a user clicks on a rectangle another one is draw.

import javax.swing.; 
import java.awt.; 
import java.awt.event.*;

public class stuff extends JApplet {

public void paint(Graphics g)
{
    super.paint(g);

    g.drawRect(40, 40, 200, 200);

    if(g.isSelected())
    {
        g.drawRect(20, 20, 50, 50);
    }
}

}
kingofdrew
Newbie Poster
4 posts since Feb 2011
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: