/************************************************** * Author: Morrison * Date: 12 Apr 202021 **************************************************/ import javafx.application.Application; import javafx.application.Platform; import javafx.stage.Stage; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.TextField; import javafx.scene.layout.BorderPane; import javafx.scene.layout.GridPane; public class RPN extends Application { private final TextField display; private NumberButton[] digits; private NumberButton decimalPoint; private NumberButton exponent; private Button clearButton; Button clearEntryButton; Button enterButton; public RPN() { display = new TextField(); digits = new NumberButton[10]; for(int k = 0; k < 10; k++) { digits[k] = new NumberButton((char)(0x30 + k)); } decimalPoint = new NumberButton('.'); clearButton = new Button("C"); clearEntryButton = new Button("CE"); enterButton = new Button("ENTER"); } @Override public void init() { } @Override public void start(Stage primary) { BorderPane bp = new BorderPane(); GridPane gp = new GridPane(); bp.setTop(display); bp.setCenter(gp); primary.setScene(new Scene(bp, 700, 500)); primary.show(); } @Override public void stop() { } /********************** Inner Classes ********************/ class NumberButton extends Button { private final char num; public NumberButton(char num) { super("" + num); this.num = num; setOnAction( e -> { }); } } class OpButton extends Button { } class FunctionButton extends Button { } }