|
|
|
@ -16,7 +16,6 @@ public class Calculater extends Application {
|
|
|
|
|
public static void main(String[] args) {
|
|
|
|
|
launch(args);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void start(Stage primaryStage) {
|
|
|
|
|
// Create display label
|
|
|
|
@ -25,10 +24,8 @@ public class Calculater extends Application {
|
|
|
|
|
display.setMinWidth(200); // Adjust width for display
|
|
|
|
|
display.setAlignment(Pos.CENTER_RIGHT); // Align text to the right
|
|
|
|
|
|
|
|
|
|
// Set up the buttons
|
|
|
|
|
GridPane gridPane = createButtonGrid();
|
|
|
|
|
|
|
|
|
|
// Create the layout
|
|
|
|
|
VBox layout = new VBox(10);
|
|
|
|
|
layout.setPadding(new Insets(10));
|
|
|
|
|
layout.setAlignment(Pos.CENTER);
|
|
|
|
@ -39,6 +36,7 @@ public class Calculater extends Application {
|
|
|
|
|
primaryStage.setTitle("Calculator");
|
|
|
|
|
primaryStage.setScene(scene);
|
|
|
|
|
primaryStage.show();
|
|
|
|
|
//
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private GridPane createButtonGrid() {
|
|
|
|
@ -59,7 +57,6 @@ public class Calculater extends Application {
|
|
|
|
|
// Set button size
|
|
|
|
|
int buttonSize = 50;
|
|
|
|
|
|
|
|
|
|
// Add buttons to the grid
|
|
|
|
|
int row = 0;
|
|
|
|
|
for (int i = 0; i < buttonText.length; i++) {
|
|
|
|
|
for (int j = 0; j < buttonText[i].length; j++) {
|
|
|
|
|