大侠看看吧 教下我哈
package colors; import com.sun.javafx.runtime.annotation.Def; def size=19; def space=3; def num_columns=10; def num_rows=14; Def colors=["aliceblue","antiquewhite",...,"yellowgreen"] Var color="white"; Stage { title: "Colors" scene: Scene { fill: bind Color.Web(color) width: space+(space+size)*num_columns height: space+(space+size)*num_rows content: for(currentColor in colors) Rectangle{ def j:Integer=indexof currentColor/num_columns; def i:Integer=indexof currentColor-j*num_columns; fill:Color.Web(currentColor) x:space+(space+size)*i y:space+(space+size)*j width:size height:size onMouseClicked:function(event){ color=currentColor } }//Rectangle }//Scene }//Stage
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
告诉你,不要抄书了,下2.0吧!
楼猪强悍~
點點點也抄?
没有提示的吗?
呵呵
这抄得真是一丝不苟
Def colors=[
"aliceblue"
,
"antiquewhite"
,...,
"yellowgreen"
] 改成
def colors=[
"aliceblue"
,
"antiquewhite"
,
"yellowgreen"
]
试试看