Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions oolab/src/main/java/agh/ics/oop/gui/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,11 @@ public class App extends Application{
// }
@Override
public void start(Stage primaryStage) throws Exception {
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/mainView.fxml"));
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/configuration.fxml"));
Scene scene = new Scene(fxmlLoader.load());
primaryStage.setTitle("Evolution Simulator");
primaryStage.setTitle("START");
primaryStage.setScene(scene);
primaryStage.show();
Stage stage=new Stage();
FXMLLoader fxmlLoader2 = new FXMLLoader(getClass().getResource("/configuration.fxml"));
Scene scene2 = new Scene(fxmlLoader2.load());
stage.setTitle("START");
stage.setScene(scene2);
stage.show();
}

}
28 changes: 27 additions & 1 deletion oolab/src/main/java/agh/ics/oop/gui/ConfigurationController.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,30 @@
package agh.ics.oop.gui;

public class ConfigurationController {
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;

import java.net.URL;
import java.util.ResourceBundle;

public class ConfigurationController implements Initializable {
@FXML
private TextField filePath;
@FXML
private Label infoLabel;
@Override
public void initialize(URL location, ResourceBundle resources) {
infoLabel.setText("Start first simulation!");
}
@FXML
public void startSimulation(){
try{
String path= filePath.getText();
//tu trzeba spróbować wczytać plik konfiguracyjny
infoLabel.setText("Your simulation is opened in a new window. You can start another one.");
//i odpalić symulacje w nowym wątku
}
catch(Exception exception){infoLabel.setText("Wrong config file path. Try again.");}
}
}
31 changes: 15 additions & 16 deletions oolab/src/main/resources/configuration.fxml
Original file line number Diff line number Diff line change
@@ -1,34 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>

<?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?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.text.*?>

<GridPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="150.0" prefWidth="300.0" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/19">
<GridPane alignment="CENTER" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="200.0" prefWidth="300.0" xmlns="http://javafx.com/javafx/17.0.2-ea" xmlns:fx="http://javafx.com/fxml/1" fx:controller="agh.ics.oop.gui.ConfigurationController">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="191.5" minWidth="4.0" prefWidth="55.5" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="505.5" minWidth="10.0" prefWidth="243.5" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="142.5" minWidth="10.0" prefWidth="52.5" />
</columnConstraints>
<rowConstraints>
<RowConstraints maxHeight="91.0" minHeight="10.0" prefHeight="82.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="117.5" minHeight="10.0" prefHeight="84.5" vgrow="SOMETIMES" />
<RowConstraints maxHeight="61.5" minHeight="10.0" prefHeight="15.5" vgrow="SOMETIMES" />
<RowConstraints maxHeight="91.0" minHeight="10.0" prefHeight="55.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="133.5" minHeight="10.0" prefHeight="92.5" vgrow="SOMETIMES" />
<RowConstraints maxHeight="69.5" minHeight="10.0" prefHeight="52.5" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<VBox alignment="CENTER" prefHeight="200.0" prefWidth="100.0" GridPane.columnIndex="1" GridPane.rowIndex="1">
<VBox alignment="CENTER" prefHeight="102.0" prefWidth="227.0" GridPane.columnIndex="1" GridPane.rowIndex="1">
<children>
<Label text="Enter config file path" />
<TextField />
<Button mnemonicParsing="false" text="START SIMULATION" />
<TextField fx:id="filePath" />
<Button mnemonicParsing="false" onAction="#startSimulation" text="START SIMULATION" />
</children>
</VBox>
<VBox alignment="CENTER" GridPane.columnIndex="1">
<VBox alignment="BOTTOM_CENTER" GridPane.columnIndex="1">
<children>
<Label contentDisplay="CENTER" text="Choose evolution configuration!" textFill="#ff00c3">
<font>
Expand All @@ -37,5 +32,9 @@
</Label>
</children>
</VBox>
<VBox alignment="TOP_CENTER" prefHeight="34.0" prefWidth="227.0" GridPane.columnIndex="1" GridPane.rowIndex="2">
<children>
<Label fx:id="infoLabel" alignment="CENTER" contentDisplay="CENTER" textAlignment="CENTER" wrapText="true" />
</children></VBox>
</children>
</GridPane>
43 changes: 18 additions & 25 deletions oolab/src/main/resources/mainView.fxml
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.layout.BorderPane?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.RowConstraints?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.shape.Circle?>
<?import javafx.scene.shape.Rectangle?>
<?import javafx.scene.text.Font?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.shape.*?>
<?import javafx.scene.text.*?>

<GridPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="600.0" prefWidth="800.0" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/19">
<GridPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="600.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/17.0.2-ea" xmlns:fx="http://javafx.com/fxml/1">
<columnConstraints>
<ColumnConstraints maxWidth="86.0093765258789" minWidth="8.796895027160645" prefWidth="12.518752098083496" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="393.34375" minWidth="10.0" prefWidth="336.9812479019165" />
Expand Down Expand Up @@ -67,12 +60,12 @@
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<Label text="Number of animals" />
<Label text="Amount of grass" GridPane.rowIndex="1" />
<Label text="Number of empty fields" GridPane.rowIndex="2" />
<Label text="The most popular genome" GridPane.rowIndex="3" />
<Label text="Average energy level" GridPane.rowIndex="4" />
<Label text="Average life length" GridPane.rowIndex="5" />
<Label text=" Number of animals" />
<Label text=" Amount of grass" GridPane.rowIndex="1" />
<Label text=" Number of empty fields" GridPane.rowIndex="2" />
<Label text=" The most popular genome" GridPane.rowIndex="3" />
<Label text=" Average energy level" GridPane.rowIndex="4" />
<Label text=" Number of animals" GridPane.rowIndex="5" />
</children>
</GridPane>
</children>
Expand Down Expand Up @@ -111,13 +104,13 @@
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<Label text="Genome" />
<Label text="Active gene" GridPane.rowIndex="1" />
<Label text="Energy" GridPane.rowIndex="2" />
<Label text="Amount of eaten grass" GridPane.rowIndex="3" />
<Label text="Number of children" GridPane.rowIndex="4" />
<Label text="Days alive" GridPane.rowIndex="5" />
<Label text="Day of death" GridPane.rowIndex="6" />
<Label text=" Genome" />
<Label text=" Active gene" GridPane.rowIndex="1" />
<Label text=" Energy" GridPane.rowIndex="2" />
<Label text=" Amount of eaten grass" GridPane.rowIndex="3" />
<Label text=" Number of children" GridPane.rowIndex="4" />
<Label text=" Days alive" GridPane.rowIndex="5" />
<Label text=" Day of death" GridPane.rowIndex="6" />
</children>
</GridPane>
</children>
Expand Down