您的位置:首页 > 产品设计 > UI/UE

JAVAFX:在图形场景中显示 UI 对象

2009-01-01 21:46 302 查看
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.paint.LinearGradient;
import javafx.scene.paint.Stop;
import javafx.scene.paint.Color;
import javafx.scene.shape.Circle;
import javafx.scene.image.Image;
import javafx.scene.Node;
import javafx.scene.text.Text;
import javafx.scene.transform.Rotate;
import javafx.scene.transform.Transform;
import javafx.scene.image.ImageView;

Stage{
    height:600
    width:800
    visible:true
    scene:Scene{
        fill:LinearGradient{              //线性填充
            startX:0 startY:0 endX:800 endY:0  proportional:false
            stops:[Stop{offset:0.0 color:Color.BURLYWOOD},
            Stop{offset:1.0 color:Color.WHITE}]
                           }
        content:[Circle {          //圆
                centerX:400,
                centerY:300
                radius: 100
                fill: Color.AZURE
            },Text{               //文本
                content:"jijljigjle"
                transforms:Transform.rotate(180, 200, 180)          //以坐标(200,180)为圆心旋转180度
            },ImageView {
            x:40 y:50 fitWidth:50 fitHeight:50          //将图片收缩为50*50  
                image: Image {
                    url: "{__DIR__}009.png"               //{__DIR__}为源文件的目录
                }
            }

        ]
    }

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  javafx 图形 ui image import url