Skip to content

Commit

Permalink
Merge pull request #3 from danieskj/danieskj/testing_javafx
Browse files Browse the repository at this point in the history
Danieskj/testing javafx
  • Loading branch information
pawelsa authored Feb 18, 2026
2 parents 1cfcd0a + d0deecf commit d00d7ad
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 30 additions & 8 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,36 @@
<version>25.0.1</version>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>6.0.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>25.0.1</version>
</dependency>


<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-web</artifactId>
<version>25.0.1</version>
</dependency>

<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-swing</artifactId>
<version>25.0.1</version>
</dependency>

<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-media</artifactId>
<version>25.0.1</version>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>6.0.1</version>
<scope>test</scope>
</dependency

</dependencies>

Expand All @@ -60,7 +82,7 @@
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.8</version>
<configuration>
<mainClass>edu.ntnu.idi.idatt.Main</mainClass>
<mainClass>edu.ntnu.idi.idatt.gui.javafx</mainClass>
</configuration>
</plugin>

Expand Down
44 changes: 44 additions & 0 deletions src/main/java/edu/ntnu/idi/idatt/gui/javafx.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package edu.ntnu.idi.idatt.gui;

import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.paint.Color;
import javafx.stage.Stage;

import java.awt.*;
import java.io.IOException;

public class javafx extends Application {
@Override
public void start (Stage stage) throws IOException {
Image stonk = new Image(getClass().getResource("/edu.ntnu.idi.idatt/stonks.png").toExternalForm());
Button week = new Button("Week 5: Play");
week.setPrefSize(150, 50);
week.setTranslateX(565);
Button logo = new Button();
Button user = new Button();
ImageView user_image = new ImageView(new Image(getClass().getResource("/edu.ntnu.idi.idatt/user.png").toExternalForm()));
ImageView logo_image = new ImageView(new Image(getClass().getResource("/edu.ntnu.idi.idatt/logo.png").toExternalForm()));
logo_image.setFitHeight(100);
logo_image.setFitWidth(100);
user_image.setFitHeight(100);
user_image.setFitWidth(100);
logo.setGraphic(logo_image);
user.setGraphic(user_image);
user.setTranslateX(1170);
ImageView stonks = new ImageView(stonk);
stonks.setX(440);
stonks.setY(220);
Group noe = new Group(stonks, week, logo, user);
Scene scene1 = new Scene(noe, 1280, 720, Color.DEEPSKYBLUE);
logo.setOnAction(e -> stage.setScene(new Scene(new Group(stonks,week,logo,user),1280, 720, Color.DEEPSKYBLUE)));
user.setOnAction(e -> stage.setScene(new Scene(new Group(logo,user),1280, 720, Color.BLACK)));
week.setOnAction(e -> stage.close());
stage.setScene(scene1);
stage.show();
}
}
Binary file added src/main/resources/edu.ntnu.idi.idatt/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/resources/edu.ntnu.idi.idatt/user.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit d00d7ad

Please sign in to comment.