erfolg nr 1
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
|
||||
package ChatProgramm.controller;
|
||||
|
||||
import java.awt.Point;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseMotionListener;
|
||||
import ChatProgramm.model.GrafikModel;
|
||||
import ChatProgramm.view.GrafikView;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author le
|
||||
*/
|
||||
public class GrafikController extends MouseAdapter implements MouseMotionListener
|
||||
{
|
||||
private GrafikView view;
|
||||
private GrafikModel model;
|
||||
|
||||
public GrafikController(GrafikView view, GrafikModel model)
|
||||
{
|
||||
this.view = view;
|
||||
this.model = model;
|
||||
}
|
||||
|
||||
public void registerEvents()
|
||||
{
|
||||
view.addMouseMotionListener(this);
|
||||
view.addMouseListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseDragged(MouseEvent evt)
|
||||
{
|
||||
Point p = evt.getPoint();
|
||||
model.addPoint(p);
|
||||
view.drawPoint(p);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseMoved(MouseEvent e)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseReleased(MouseEvent evt)
|
||||
{
|
||||
model.endShape();
|
||||
// if (evt.getButton() == MouseEvent.BUTTON3)
|
||||
// {
|
||||
// view.doPrint();
|
||||
// }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user