下面是一个简单的JavaFX计算器示例:
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;public class Calculator extends Application {private TextField resultField;private Button clearButton;private Button backButton;private Button plusButton;private Button minusButton;private Button multiplyButton;private Button divideButton;private Button equalButton;private Button decimalButton;private Button[] numberButtons;public static void main(String[] args) {launch(args);}@Overridepublic void start(Stage primaryStage) throws Excepti