Skip to content
Snippets Groups Projects
Commit 648aeb08 authored by Jerusalem Laila's avatar Jerusalem Laila
Browse files

Start Screen GUI implemented

parent 0c2aa690
No related branches found
No related tags found
No related merge requests found
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
</list> </list>
</option> </option>
</component> </component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="17" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_19" default="true" project-jdk-name="17" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" /> <output url="file://$PROJECT_DIR$/out" />
</component> </component>
</project> </project>
\ No newline at end of file
...@@ -5,4 +5,6 @@ module gui { ...@@ -5,4 +5,6 @@ module gui {
opens org.example to javafx.fxml; opens org.example to javafx.fxml;
exports org.example; exports org.example;
exports org.example.gui;
opens org.example.gui to javafx.fxml;
} }
\ No newline at end of file
package org.example.gui;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
public class StartScreen extends Application {
// private final static Logger logger = LogManager.getLogger(SnakeGame.class);
// private static final int width = 600; //width of window
// private static final int height = 500; //height of window
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage stage) throws Exception{
Parent root = FXMLLoader.load(getClass().getResource("/fxml/start.fxml"));
Scene scene = new Scene(root);
stage.setTitle("Snake Game");
stage.setScene(scene);
stage.show();
}
}
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.RowConstraints?>
<GridPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/19">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<Label text="PROJECT S">
<GridPane.margin>
<Insets left="270.0" right="100.0" />
</GridPane.margin>
</Label>
<TextField minWidth="-Infinity" prefHeight="50.0" prefWidth="100.0" snapToPixel="false" text="Enter your name" GridPane.rowIndex="1">
<GridPane.margin>
<Insets left="100.0" right="100.0" />
</GridPane.margin>
</TextField>
<Button mnemonicParsing="false" text="Start" GridPane.rowIndex="2">
<GridPane.margin>
<Insets left="260.0" />
</GridPane.margin>
<padding>
<Insets bottom="20.0" left="30.0" right="30.0" top="20.0" />
</padding>
</Button>
</children>
</GridPane>
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