Skip to content
Snippets Groups Projects
Commit 70d9a1f4 authored by Anders Emil Bergan's avatar Anders Emil Bergan
Browse files

Finished the start meny layout and also made it a class that runs from main class 'MyApp'.

parent 3690d23f
No related branches found
No related tags found
1 merge request!6Merging the frontend baseline to get up to date with the progress
Pipeline #201691 canceled
......@@ -8,11 +8,12 @@ import no.ntnu.idatt1002.demo.view.MyWindow;
*/
public class MyApp {
static StartMenu menu = new StartMenu();
/**
* Main method for my application
*/
public static void main(String[] args) throws Exception {
MyWindow window = new MyWindow("The Window");
window.setVisible(true);
menu.start();
}
}
package no.ntnu.idatt1002.demo;
import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.*;
import javafx.scene.text.*;
import javafx.stage.Stage;
import java.io.FileInputStream;
import java.io.IOException;
public class StartMenu extends Application{
@Override
public void start(Stage primaryStage) throws IOException {
primaryStage.setTitle("BudgetBuddy");
ImageView bck = new ImageView(new Image(new FileInputStream("src/main/resources/Defaults/budgetbuddycover.jpeg")));
bck.setPreserveRatio(true);
bck.setFitWidth(750);
StackPane pane = new StackPane();
HBox buttons = new HBox();
VBox layout = new VBox();
Button opt1 = new Button("Start New Budget");
Button opt2 = new Button("Continue Ongoing Budget");
opt1.setPadding(new Insets(20,100,20,100));
opt2.setPadding(new Insets(20,100,20,100));
buttons.getChildren().addAll(opt1, opt2);
buttons.setAlignment(Pos.CENTER);
buttons.setSpacing(75);
Text text = new Text();
String textContent = "BudgetBuddy";
text.setText(textContent);
text.setFont(Font.font("verdana", FontWeight.BOLD, FontPosture.REGULAR, 60));
layout.getChildren().addAll(text, buttons);
layout.setAlignment(Pos.CENTER);
layout.setSpacing(100);
pane.getChildren().addAll(bck, layout);
Scene scene = new Scene(pane);
primaryStage.setScene(scene);
primaryStage.setResizable(false);
primaryStage.show();
}
public void start() {
start();
}
}
package no.ntnu.idatt1002.demo;
import javafx.application.Application;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.*;
import javafx.stage.Stage;
import javafx.scene.control.Label;
import java.io.FileInputStream;
import java.io.InputStream;
public class UI extends Application{
@Override
public void start(Stage stage) throws Exception {
Label label = new Label("Title");
VBox rootV = new VBox();
HBox rootH = new HBox();
Scene scene = new Scene(rootH, 500, 500);
Button btnNormal = new Button("_Normal");
Button btnDefault = new Button("_Default");
Button btnCancel = new Button("_Cancel");
btnDefault.setDefaultButton(true);
btnCancel.setCancelButton(true);
btnNormal.setOnAction(event ->{
normalButton();
});
btnDefault.setOnAction(event ->{
defaultButton();
});
btnCancel.setOnAction(event ->{
cancelButton();
});
ImageView bck = new ImageView(new Image(new FileInputStream("src/main/resources/Defaults/Journey.png")));
rootH.getChildren().add(bck);
rootH.getChildren().addAll(btnNormal, btnDefault, btnCancel);
rootH.setAlignment(Pos.BOTTOM_CENTER);
rootH.setSpacing(10);
rootV.getChildren().add(rootH);
stage.setScene(scene);
stage.setTitle("Menu");
stage.show();
}
private void normalButton(){
System.out.println("Button activated for normal");
}
private void defaultButton(){
System.out.println("Button activated for default");
}
private void cancelButton(){
System.out.println("Button activated for cancel");
}
public static void main(String[] args) {
launch(args);
}
}
src/main/resources/Defaults/Journey.png

831 KiB

src/main/resources/Defaults/budgetbuddycover.jpeg

143 KiB

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment