/* Author: Luigi Vincent
*
*/

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.TextField;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.GridPane;
import javafx.stage.Stage;

public class Calculator extends Application {
	public static void main(String[] args) {
		launch(args);
	}

	@Override
	public void start(Stage stage) {
		BorderPane layout = new BorderPane();

		TextField result = new TextField();
		result.setStyle("-fx-font-size: 40");
		result.setMaxWidth(400);
		result.setEditable(false);
		layout.setTop(result);
		
		GridPane buttonLayout = new GridPane();
		layout.setCenter(buttonLayout);

		Button backButton = new Button("\u2190");
		backButton.setMinSize(100, 100);
		buttonLayout.add(backButton, 2, 0);

		Button clearButton = new Button("Clear");
		clearButton.setMinSize(200, 100);
		GridPane.setColumnSpan(clearButton, 2);	
		buttonLayout.add(clearButton, 0, 0);

		Button[] numberButtons = new Button[10];
		for (int i = 3, target = 1; i >= 1; i--) {
			for (int j = 0; j <= 2; j++) {
				numberButtons[target] = new Button(Integer.toString(target));
				numberButtons[target].setMinSize(100, 100);
				buttonLayout.add(numberButtons[target++], j, i);
			}	
		}


		String[] operators = {"\u00F7", "x", "-", "+", "="};
		Button[] operatorButtons = new Button[operators.length];

		for (int i = 0; i < operators.length; i++) {
			operatorButtons[i] = new Button(operators[i]);
			operatorButtons[i].setMinSize(100, 100);
			operatorButtons[i].setStyle("-fx-color: orange");
			buttonLayout.add(operatorButtons[i], 3, i);
		}

		stage.setScene(new Scene(layout));
		stage.setTitle("Legato's Calculator");
		stage.show();
	}
} 
@@ -59,24 +59,55 @@
 pplication;%0A
+import javafx.geometry.Insets;%0A
 import javaf
@@ -117,24 +117,24 @@
 cene.Scene;%0A
-
 import javaf
@@ -594,20 +594,56 @@
 xWidth(4
-00);
+15); // total width + margins of buttons
 %0A%09%09resul
@@ -734,16 +734,134 @@
 Pane();%0A
+%09%09buttonLayout.setPadding(new Insets(10, 0, 0, 0));%0A        buttonLayout.setHgap(5);%0A        buttonLayout.setVgap(5);%0A
 %09%09layout
@@ -1468,16 +1468,309 @@
 %7D%09%0A%09%09%7D%0A%0A
+%09%09numberButtons%5B0%5D = new Button(%220%22);%0A%09%09numberButtons%5B0%5D.setMinSize(200, 100);%0A%09%09GridPane.setColumnSpan(numberButtons%5B0%5D, 2);%0A%09%09buttonLayout.add(numberButtons%5B0%5D, 0, 4);%0A%0A%09%09Button decimalButton = new Button(%22.%22);%0A%09%09decimalButton.setMinSize(100, 100);%0A%09%09buttonLayout.add(decimalButton, 2, 4);%0A%0A
 %0A%09%09Strin
@@ -2123,16 +2123,16 @@
 );%0A%09%09%7D%0A%0A
-
 %09%09stage.
@@ -2160,16 +2160,68 @@
 yout));%0A
+%09%09stage.setResizable(false);%0A%09%09stage.sizeToScene();%0A
 %09%09stage.

update layout structure