I am selecting the area of a component by mouse click and in the "mouseReleased" method I am taking "GraphicsContext " of that component.Using this "g",I am drawing a rectangle of selected area size.It is displayed when I select the area for the second time.First time hte component disappears for a fraction of a second and then it reappears.
So can anybody throw some light on it?I want user to be known about his area selection everytime he selects the area.
public void mouseReleased(MouseEvent me)
{
xend=me.getX();
yend=me.getY();
Graphics g=visualComponent.getGraphics();
visualComponent.setForeground(Color.red);
g.drawRect(xstart,ystart,xend-xstart,yend-ystart);
repaint();
}
Also there is paint method that has "Graphics g" parameter as usual.