G
Gast29
Gast
Hi, wie kann ich jetzt hier einfügen, dass das verschobene Quadrat gezeichnet bleibt und man auch per mouseclick es vergrößern kann.
MfG und thx
Gast29 ^^
MfG und thx
Gast29 ^^
Code:
import java.applet.*; import java.awt.*; import java.awt.event.*;
public class Malen2 extends Applet implements MouseMotionListener{
Graphics stift;
int lastx,lasty;
public void init(){
addMouseMotionListener(this);
stift=getGraphics();
}
/*public void paint(MouseEvent e){
int x1,y1;
x1=e.getX();y1=e.getX();
stift.drawRect(x1,y1,50,50);
}*/
public void mouseDragged(MouseEvent e){
int x,y;
x=e.getX(); y=e.getY();
repaint();
stift.setColor(Color.black);
stift.drawRect(x,y,50,50);
stift.drawRect(x,y,50,50);
}
public void mouseMoved(MouseEvent e){
}
}