Skip to content

Instantly share code, notes, and snippets.

@BMU-Verlag
Created October 10, 2019 15:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BMU-Verlag/b0ee9d7991066af2b70b1f137114b3be to your computer and use it in GitHub Desktop.
Save BMU-Verlag/b0ee9d7991066af2b70b1f137114b3be to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.layout.GridPane?>
<AnchorPane xmlns:fx="http://javafx.com/fxml/1" stylesheets="@application.css"
fx:controller="application.CalculatorController" fx:id="body">
<Label fx:id="lastResult" />
<Label fx:id="input" layoutY="80" />
<GridPane fx:id="numberField" layoutY="160">
<Button fx:id="one" text="1" onAction="#handleInput" GridPane.columnIndex="0" GridPane.rowIndex="0" />
<Button fx:id="two" text="2" onAction="#handleInput" GridPane.columnIndex="1" GridPane.rowIndex="0" />
<Button fx:id="three" text="3" onAction="#handleInput" GridPane.columnIndex="2" GridPane.rowIndex="0" />
<Button fx:id="four" text="4" onAction="#handleInput" GridPane.columnIndex="0" GridPane.rowIndex="1" />
<Button fx:id="five" text="5" onAction="#handleInput" GridPane.columnIndex="1" GridPane.rowIndex="1" />
<Button fx:id="six" text="6" onAction="#handleInput" GridPane.columnIndex="2" GridPane.rowIndex="1" />
<Button fx:id="seven" text="7" onAction="#handleInput" GridPane.columnIndex="0" GridPane.rowIndex="2" />
<Button fx:id="eight" text="8" onAction="#handleInput" GridPane.columnIndex="1" GridPane.rowIndex="2" />
<Button fx:id="nine" text="9" onAction="#handleInput" GridPane.columnIndex="2" GridPane.rowIndex="2" />
<Button fx:id="zero" text="0" onAction="#handleInput" GridPane.columnIndex="0" GridPane.rowIndex="3" />
<Button fx:id="comma" text="," onAction="#handleInput" GridPane.columnIndex="1" GridPane.rowIndex="3" />
<Button fx:id="eval" text="=" GridPane.columnIndex="2" GridPane.rowIndex="3" />
<Button fx:id="add" text="+" GridPane.columnIndex="3" GridPane.rowIndex="0" />
<Button fx:id="subtract" text="-" GridPane.columnIndex="3" GridPane.rowIndex="1" />
<Button fx:id="multiply" text="*" GridPane.columnIndex="3" GridPane.rowIndex="2" />
<Button fx:id="divide" text="/" GridPane.columnIndex="3" GridPane.rowIndex="3" />
</GridPane>
</AnchorPane>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment