JavaFX 中鼠标颜色更改效果
我想更改此代码,以便当我单击球时,它会变成红色。有人可以帮助我吗?我是java新手: http://download.oracle.com/javafx/1.3/tutorials /ui/syntax/index.html
I want to change this code so when I click on the ball, it turns red. Can anyone help me? I'm new to java:
http://download.oracle.com/javafx/1.3/tutorials/ui/syntax/index.html
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
试试这个:
这里有两个变化:
1)将Circle提取到变量(圆)中,以便以后使用。
2)向矩形添加鼠标单击事件,以翻转颜色。
Try this:
Two changes here:
1) Extract Circle in a variable (circle), so that it can be used later.
2) Add a mouse clicked event to the rectangle, to flip colors.
你只需要把这里的“circle”改成“矩形”
,然后放入这句话 var矩形:矩形;就像
var Circle: Circle;
you just have to change the word circle into rectangle right here
and put in this sentence var rectangle : Rectangle; just like
var circle: Circle;