Node抽象类的通用属性和方法

结点有许多通用的属性,这里介绍 style和 rotate
setStyle()等价于setStroke()和 setFill(),可以设置边框颜色和填充颜色
setRotate()可以设置旋转的角度

public class Demo extends Application{
	public static void main(String[]args) {
		Application.launch(args);
		
	}
	@Override
	public void start(Stage primaryStage) throws Exception {
		// TODO Auto-generated method stub
		Pane pane=new Pane();
		Circle bt=new Circle(50,50,50);
		Button b=new Button("ok");
		pane.getChildren().addAll(bt,b);
		
		bt.setStyle("-fx-stroke: black; -fx-fill: red;");//黑边 红色填充
		b.setRotate(80);//旋转角度顺时针80
		
		Scene scene=new Scene(pane,500,500);
		primaryStage.setScene(scene);
		primaryStage.show();
	}

}

在这里插入图片描述

Color类和 Font类
一般可以有 Color.颜色常量 调用相应颜色
Font.font(名字,粗细,字形,大小) 创建相应字体

posted @ 2019-07-02 10:08  少年留不住  阅读(227)  评论(0)    收藏  举报