public void mouseDragged(MouseEvent e) {
		if (image !=null && tileset) {
			if (e.getX()>=0 && e.getX() <image.getWidth() && e.getY() >= 0 && e.getY() < image.getHeight()) {
				tileSelected = new Vector<Integer>();
				int XM = Math.abs((e.getX()/(8*zoom))-x0)+1;
				int YM = Math.abs((e.getY()/(8*zoom))-y0)+1;
				int signx=((e.getX()/(8*zoom))-x0);
				int signy=((e.getY()/(8*zoom))-y0);
				
				for (int i=0;i<XM*(YM*(image.getWidth()/(8*zoom)));i++) tileSelected.add(-1);
				if (signx>=0 && signy>=0) {
					for (int x=0; x<XM;x++) {
						for (int y=0;y<YM;y++) {
							tileSelected.set(x+(y*(image.getWidth()/(8*zoom))), x+x0+((y+y0)*(image.getWidth()/(8*zoom))));// = (e.getX() / 8) + ((e.getY()/8)*(image.getWidth()/8));
						}
					}
				} else if (signx<0 && signy>0) {
					for (int x=0; x<XM;x++) {
						for (int y=0;y<YM;y++) {
							tileSelected.set(x+(y*(image.getWidth()/(8*zoom))), x+(e.getX()/(8*zoom))+((y+y0)*(image.getWidth()/(8*zoom))));// = (e.getX() / 8) + ((e.getY()/8)*(image.getWidth()/8));
						}
					}
				} else if (signx>0 && signy<0) {
					for (int x=0; x<XM;x++) {
						for (int y=0;y<YM;y++) {
							tileSelected.set(x+(y*(image.getWidth()/(8*zoom))), x+x0+((y+(e.getY()/(8*zoom)))*(image.getWidth()/(8*zoom))));// = (e.getX() / 8) + ((e.getY()/8)*(image.getWidth()/8));
						}
					}
				} else {
					for (int x=0; x<XM;x++) {
						for (int y=0;y<YM;y++) {
							tileSelected.set(x+(y*(image.getWidth()/(8*zoom))), x+(e.getX()/(8*zoom))+((y+(e.getY()/(8*zoom)))*(image.getWidth()/(8*zoom))));// = (e.getX() / 8) + ((e.getY()/8)*(image.getWidth()/8));
						}
					}
				}
		      repaint();
			}
		}
		
	}