/** * Causes the module to resize as the specified Vector. * * <p>This method is NOT overloadable because very specific things need to happen when resized for * the module to work correctly. * * @param v The Vector to resize to. */ public final void resize(Vector v) { v.x = v.x < 0 ? 0 : v.x; v.y = v.y < 0 ? 0 : v.y; onResize(v); bounds.size = new Vector( v); // The Vector is copied so that nothing has a reference to size through a // refererence // doRenderCalc(); repaint(); // repaint(); }
/** * Causes the module to resize to the specified width and height. * * <p>This method is NOT overloadable because very specific things need to happen when resized for * the module to work correctly. * * @param width The new width of the module. * @param height The new height of the module. */ public final void resize(int width, int height) { width = width < 0 ? 0 : width; // The Module should not be resizable to less than zero height = height < 0 ? 0 : height; onResize( new Vector( width, height)); // Call the onResize() method in case a subclass cares when it is resized bounds.size = new Vector(width, height); // Update the size of the bounds // doRenderCalc(); //Re-do render calculations because this now has a different buffer size // repaint(); //Redraw in case it needs to be re-drawn repaint(); }