如何在Java中为矩形2D添加5px [英] How to add 5px for a rectangle2D in Java

查看:108
本文介绍了如何在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().


这篇关于如何在Java中为矩形2D添加5px的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆