大侠看看吧 教下我哈

发布于 2021-11-11 12:53:32 字数 1095 浏览 929 评论 8

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

你曾走过我的故事 2021-11-13 00:39:11

告诉你,不要抄书了,下2.0吧!

三月梨花 2021-11-13 00:30:29

楼猪强悍~

傾城如夢未必闌珊 2021-11-12 23:48:23

點點點也抄?

柠檬 2021-11-12 23:18:17

没有提示的吗?

疑心病 2021-11-12 19:49:05

这抄得真是一丝不苟

霞映澄塘 2021-11-12 14:41:41

Def colors=["aliceblue","antiquewhite",...,"yellowgreen"] 改成

def colors=["aliceblue","antiquewhite","yellowgreen"]

试试看

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文