public void reformTransform(Rectangle viewBounds) {
		//completely unrelated
//		MouseListener[] k;
//	    System.out.println((k = this.getListeners(MouseListener.class)).length);	
//	    for (int i = 0; i < k.length; i++)
//	    	System.out.println(k[i]);
		
		//end completely unrelated
	    
	    
	    
		transformNeedsReform = false;
//		System.out.print("hello\n");
		Rectangle bounds = new Rectangle(getAutomatonBounds());
		if (!adapt) {
			// Much of this is to make sure that this component
			// displays properly in a scroll box. (It must work
			// either in a scroll box, or not!)
			Rectangle visible = getVisibleRect();
			// What is the point of the upper left corner of the
			// viewport in automaton drawer space?
			Point viewportUpperLeft = new Point((int) (visible.x - transform
					.getTranslateX()), (int) (visible.y - transform
					.getTranslateY()));
			// What is the point of the upper left corner of the
			// scrolling component in automaton drawer space?
			Point componentUpperLeft = new Point(Math.min(bounds.x, Math.min(0,
					viewportUpperLeft.x)), Math.min(bounds.y, Math.min(0,
					viewportUpperLeft.y)));
			// Make the transform draw the automaton in the
			// appropriate location.
			transform = new AffineTransform();
		    //push to drawer
			drawer.setTransform(transform);
			drawer.invalidateBounds();
			
			transform.translate(-componentUpperLeft.x, -componentUpperLeft.y);
			
		    
			//inserted by Henry
//			if (scaleBy > 0){
//                System.out.println("scaling now");
			    transform.scale(scaleBy, scaleBy); 	 //always and forever, you should scale
//				scaleBy = -1;
//			}
			
			
			// Set the size of the thing appropriately.
			Dimension newSize = new Dimension(Math.max(bounds.width + bounds.x,
					viewportUpperLeft.x + visible.width)
					- componentUpperLeft.x, Math.max(bounds.height + bounds.y,
					viewportUpperLeft.y + visible.height)
					- componentUpperLeft.y);
			if (newSize.equals(getPreferredSize()))
				return;
			
			
			setPreferredSize(newSize);
			// Scroll to make viewportUpperLeft an "isopoint".
			/*Rectangle scrollRect = new Rectangle(viewportUpperLeft.x
					- componentUpperLeft.x, viewportUpperLeft.y
					- componentUpperLeft.y, visible.width, visible.height);*/
			revalidate();
			scrollRectToVisible(visible);
			
			return;
		}

		// We do make the automaton fit in the visible space!
		transform = new AffineTransform();
		bounds.grow(20, 20);
		Rectangle ourBounds = viewBounds;
		double aRatio = bounds.getWidth() / bounds.getHeight();
		double vRatio = ourBounds.getWidth() / ourBounds.getHeight();
		if (aRatio > vRatio) {
			// The automaton is wider than the view.
			double targetHeight = bounds.getWidth() / vRatio;
			targetHeight -= bounds.getHeight();
			// Must extend by targetHeight.
			bounds.setRect(bounds.getX(), bounds.getY() - targetHeight / 2.0,
					bounds.getWidth(), bounds.getHeight() + targetHeight);
		} else {
			// The automaton is taller than the view.
			double targetWidth = bounds.getHeight() * vRatio;
			targetWidth -= bounds.getWidth();
			// Extend by targetWidth.
			bounds.setRect(bounds.getX() - targetWidth / 2.0, bounds.getY(),
					bounds.getWidth() + targetWidth, bounds.getHeight());
		}
		double scale = ourBounds.getWidth() / bounds.getWidth();
		transform.scale(scale, scale);
		System.out.println(scale+"..."+(ourBounds.getX() - bounds.getX()));
		transform.translate(ourBounds.getX() - bounds.getX(), ourBounds.getY()
				- bounds.getY());
		
	}