ayuda........

Edgar
14 de Noviembre del 2004
Necesito a alguien que me ayude con el codigo de un applet donde uno arratre el mouse y se valla pintando una linea.

muchas gracias

Rouken
14 de Noviembre del 2004
Viejo te mando esta ayuda para que ver si te sirve
//
import java.awt.*;
import java.awt.event.*;
public class VentanaR extends Frame implements WindowListener, MouseMotionListener,KeyListener{
public int x,y;
public String m;
public VentanaR(){
x=0;
y=0;
m="";
setTitle("Dibujable");
setSize(100,200);
setVisible(true);
addWindowListener(this);
addMouseMotionListener(this);
addKeyListener(this);
}
public static void main(String arg[]){
new VentanaR();
}
public void windowOpened(WindowEvent e){}
public void windowClosing(WindowEvent e){System.exit(0);}
public void windowClosed(WindowEvent e){}
public void windowIconified(WindowEvent e){}
public void windowDeiconified(WindowEvent e){}
public void windowActivated(WindowEvent e){}
public void windowDeactivated(WindowEvent e){}
public void mouseDragged(MouseEvent e){
this.x=e.getX();
this.y=e.getY();
this.m="arrastrar";
}
public void mouseMoved(MouseEvent e){
this.x=e.getX();
this.y=e.getY();
this.m="moviendo";
}
public void paint(Graphics g){
g.drawString(this.m,this.x,this.y);
g.drawLine(1,1,this.x,this.y);
}
public void keyTyped(KeyEvent e){}
public void keyPressed(KeyEvent e){
System.out.println(e.getKeyCode());
}
public void keyReleased(KeyEvent e){}
}