Respected Sir,
I can't understand what do you mean. Without MouseEvents how to get (x,y) co-ordinates.I want to draw shapes arbitarly and desirable locations. Please give some sample codes. Please helpe me,it is urgent. Here is my program.
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
class Draw extends JFrame implements MouseListener
{
int x,y;
Draw()
{
addMouseListener(this);
}
public void mousePressed(MouseEvent me)
{
x=me.getX();
y=me.getY();
}
public void mouseReleased(MouseEvent me)
{
int x1=me.getX();
int y1=me.getY();
Graphics g=this.getGraphics();
g.drawLine(x,y,x1,y1);
}
public void mouseClicked(MouseEvent me){}
public void mouseEntered(MouseEvent me){}
public void mouseExited(MouseEvent me){}
public static void main(
String[] args)
{
Draw dw=new Draw();
dw.setSize(300,300);
dw.setVisible(true);
System.out.println("Hello World!");
}
}