javafx给图形上颜色_javafx设置控件背景颜色,字体等

package fx.com;

import javafx.application.Application;

import javafx.event.ActionEvent;

import javafx.event.EventHandler;

import javafx.geometry.Insets;

import javafx.scene.Group;

import javafx.scene.Scene;

import javafx.scene.control.Button;

import javafx.scene.layout.*;

import javafx.scene.paint.Paint;

import javafx.scene.text.Font;

import javafx.stage.Stage;

public class Main extends Application {

public static void main(String[] args) {

launch(args);

}

@Override

public void start(Stage primaryStage) throws Exception {

Button b1 = new Button();

b1.setText("这是按钮");

b1.setLayoutX(100);

b1.setLayoutY(50);

b1.setPrefWidth(500);

b1.setPrefHeight(200);

// 设置按钮的字体

b1.setFont(Font.font("sans-

你可能感兴趣的:(javafx给图形上颜色)