-
Enhancement
-
Resolution: Unresolved
-
P4
-
None
I use a lot of Rectangles in my custom components, and often I have to set their width and height as the component is being laid out. This means I get a lot of code like this
clip.setWidth(width);
clip.setHeight(height);
aRectangle.setWidth(width);
aRectangle.setHeight(height);
anotherRectangle.setWidth(width - 2);
anotherRectangle.setHeight(height - 2);
I suggest adding a convenience method which would allow me to set both the width and the height of rectangles using a single method call. I suggest reusing the method resize() for this purpose, allowing me to substitue the code above with
clip.resize(width, height);
aRectangle.resize(width, height);
anotherRectangle.resize(width - 2, height - 2);
clip.setWidth(width);
clip.setHeight(height);
aRectangle.setWidth(width);
aRectangle.setHeight(height);
anotherRectangle.setWidth(width - 2);
anotherRectangle.setHeight(height - 2);
I suggest adding a convenience method which would allow me to set both the width and the height of rectangles using a single method call. I suggest reusing the method resize() for this purpose, allowing me to substitue the code above with
clip.resize(width, height);
aRectangle.resize(width, height);
anotherRectangle.resize(width - 2, height - 2);