如何在Java中为矩形2D添加5px

如何在Java中为矩形2D添加5px

问题描述:

我想在Java中为rectangle2D添加5px(或10px),该怎么办?
请帮帮我.
非常感谢.

I want to add 5px(or 10px) for a rectangle2D in Java.How can I do ?
Please help me.
Many thanks.

,所以您有一个宽度为i的矩形.很好,将其存储在成员变量中,并使用该成员设置宽度.
然后,只需将值j添加到值i-并更新canvas(!).这真的很重要,因为您可以更改很多值,但是它们只会在您repaint()时显示.
so you have a rectangle with a width i. Fine, store that in a member variable and set the width by using that member.
Then, simply add value j to value i - and update your canvas(!). That is really important, as you can change values around pretty much, but they will only show up when you repaint().