The Essential JViews Framework > Graphic Objects > Geometric Properties > Moving and Resizing a Graphic Object

The class IlvGraphic provides many methods for moving and resizing a graphic object:

All the above methods call applyTransform to modify the bounding rectangle of the graphic object.

public void applyTransform(IlvTransformer t)

This is the only method that needs to be overridden in order to handle the transformation of an object correctly. The following code example shows how the applyTransform method may be used in our example class, MyRectangle:

class MyRectangle extends IlvGraphic 
{
   // The rectangle that defines the object.
   final IlvRect drawrect = new IlvRect();
 
   ...
 
   public void applyTransform(IlvTransformer t)
   {
      t.apply(drawrect);
   }
}

The method simply applies the transformation to the rectangle.

Note
 Graphic objects stored in a manager (class IlvManager and its subclasses) are located in a quadtree. This means that you cannot simply call move on a graphic object because the quadtree must be notified of the modification of the graphic object. Every method that modifies the bounding rectangle of the object must call IlvManager.applyToObject. This method applies a function to an object and notifies the quadtree of the modification to the bounding rectangle. The class IlvManager also includes several convenient methods to move and reshape a graphic object managed by this manager. They are shown below:

public void moveObject(IlvGraphic, float, float, boolean)

public void reshapeObject(IlvGraphic, IlvRect, boolean)

For more information, see Modifying Geometric Properties of Objects.