import javafx.application.Application;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.TextArea;
import javafx.scene.layout.BorderPane;
import javafx.stage.Stage;
public class App15_1 extends Application {
Button bt = new Button("设置字体颜色");
TextArea ta = new TextArea("字体颜色");
@Override
public void start(Stage primaryStage) {
BorderPane bPane = new BorderPane();
bPane.setCenter(ta);
bPane.setBottom(bt);
BorderPane.setAlignment(bt, Pos.CENTER);
bt.setOnAction(event -> ta.setStyle("-fx-text-fill: red"));
Scene scene = new Scene(bPane, 180, 100);
primaryStage.setScene(scene);
primaryStage.setTitle("操作事件");
primaryStage.show();
}
public static void main(String[] args) {
Application.launch(args);
}
}