Back to index

wims  3.65+svn20090927
DrawerTool.java
Go to the documentation of this file.
00001 package rene.zirkel.tools;
00002 
00003 // file: Hider.java
00004 
00005 import java.awt.event.*;
00006 
00007 import rene.zirkel.Zirkel;
00008 import rene.zirkel.ZirkelCanvas;
00009 import rene.zirkel.constructors.*;
00010 import rene.zirkel.graphics.Drawing;
00011 
00012 public class DrawerTool extends ObjectConstructor
00013 {      Drawing D;
00014        boolean Dragging=false;
00015 
00016        public void mousePressed (MouseEvent e, ZirkelCanvas zc)
00017        {      double x=zc.x(e.getX()),y=zc.y(e.getY());
00018               D=new Drawing();
00019               D.addXY(x,y);
00020               Dragging=true;
00021               zc.addDrawing(D);
00022               D.setColor(zc.getDefaultColor());
00023        }
00024        
00025        public void mouseDragged (MouseEvent e, ZirkelCanvas zc)
00026        {      if (!Dragging) return;
00027               double x=zc.x(e.getX()),y=zc.y(e.getY());
00028               D.addXY(x,y);
00029               zc.repaint();        
00030        }
00031        
00032        public void mouseReleased (MouseEvent e, ZirkelCanvas zc)
00033        {      Dragging=false;
00034               zc.repaint();
00035        }
00036 
00037        public void showStatus (ZirkelCanvas zc)
00038        {      zc.showStatus(Zirkel.name("message.draw"));
00039        }
00040        
00041        public void reset (ZirkelCanvas zc)
00042        {      zc.clearSelected();
00043        }
00044 
00045        public boolean useSmartBoard ()
00046        {      return false;
00047        }
00048 }