Revert "MERGE::Merge branch 'fix_gradle_build_file'"

This reverts commit 309337f26d, reversing
changes made to d902c7401d.
This commit is contained in:
Sem van der Hoeven
2019-03-11 15:59:38 +01:00
parent 309337f26d
commit 7af5470a8e
206 changed files with 6303 additions and 2634 deletions

View File

@@ -0,0 +1,31 @@
package GUI;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.Label;
public class GUIController {
private int pressed;
//put @FXML to let the fxml file know that it can use this label,
//kind of the same as with @Test in jUnit tests
/**
*the label to be edited by pressing the button
*/
@FXML
private Label txtLabel;
/**
* increments the counter when the button is presssed
* @param event an event that happens (button is clicked)
* @throws Exception
*/
public void incrementLabel(ActionEvent event) throws Exception {
// System.out.println("pressed button");
pressed++;
String labeltext = "Button pressed " + pressed + " times!";
//set the text of the label to the string above
txtLabel.setText(labeltext);
}
}

23
src/GUI/GUIMain.fxml Normal file
View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.text.*?>
<?import java.lang.*?>
<?import java.util.*?>
<?import javafx.scene.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<AnchorPane prefHeight="600.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="GUI.GUIController">
<children>
<Label fx:id="txtLabel" layoutX="306.0" layoutY="248.0" text="Button pressed 0 times!">
<font>
<Font size="18.0" />
</font>
</Label>
<Button layoutX="362.0" layoutY="323.0" mnemonicParsing="false" onAction="#incrementLabel" text="Click me!">
<font>
<Font size="14.0" />
</font>
</Button>
</children>
</AnchorPane>

38
src/GUI/GUIMain.java Normal file
View File

@@ -0,0 +1,38 @@
package GUI;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
public class GUIMain extends Application {
/**
* launches the stage
* @param args
*/
public static void main(String[] args) {
launch(args);
}
/**
*
* @param primaryStage the stage to be started
* @throws Exception when the fxml file can't be found
*/
@Override
public void start(Stage primaryStage) throws Exception {
//link fxml file
Parent root = FXMLLoader.load(getClass().getResource("Login.fxml"));
//set the scene
Scene scene = new Scene(root, 400, 400);
//link the stylesheet with the scene
scene.getStylesheets().add(getClass().getResource("LoginStyle.css").toExternalForm());
//show the stagw
primaryStage.setScene(scene);
primaryStage.setTitle("login");
primaryStage.show();
}
}

3
src/GUI/GUIStyle.css Normal file
View File

@@ -0,0 +1,3 @@
.root {
-fx-background-color: #eef9ee;
}

21
src/GUI/Login.fxml Normal file
View File

@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.text.*?>
<?import java.lang.*?>
<?import java.util.*?>
<?import javafx.scene.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<AnchorPane prefHeight="400.0" prefWidth="400.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="GUI.LoginController">
<children>
<TextField fx:id="usertext" layoutX="126.0" layoutY="182.0" promptText="Username" />
<PasswordField fx:id="passwordField" layoutX="126.0" layoutY="244.0" promptText="Password" />
<Button fx:id="loginbutton" layoutX="177.0" layoutY="317.0" mnemonicParsing="false" onAction="#Login" text="Login" />
<Label fx:id="statustext" alignment="CENTER" layoutX="126.0" layoutY="91.0" textAlignment="CENTER" wrapText="true">
<font>
<Font size="14.0" />
</font>
</Label>
</children>
</AnchorPane>

View File

@@ -0,0 +1,69 @@
package GUI;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.PasswordField;
import javafx.scene.control.TextField;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
public class LoginController {
//set labels and textfields, with the @FXML line to let the fxml file know it can use these
@FXML
private Label statustext;
@FXML
private TextField usertext;
@FXML
private PasswordField passwordField;
@FXML
private Button loginbutton;
/**
* redirects to the main stage when the login credentials are correct
* @param event the entered username and password, and clicking the button
* @throws Exception
* @author Sem van der Hoeven
*/
public void Login(ActionEvent event) throws Exception {
//if the entered username and password are correct
if (usertext.getText().equals("user") && passwordField.getText().equals("pass")) {
//display green login succes message
statustext.setText("Login success!");
statustext.setTextFill(Color.GREEN);
//and open next window
openMainWindow();
} else {
//else display red login failed message
statustext.setText("Login failed! try again!");
statustext.setTextFill(Color.RED);
}
}
public void openMainWindow() throws Exception {
//basically the same thing as in the main class: open a new stage
Stage primaryStage = new Stage();
//link fxml file
Parent root = FXMLLoader.load(getClass().getResource("GUIMain.fxml"));
//set the scene
Scene scene = new Scene(root, 800, 600);
//link the stylesheet with the scene
scene.getStylesheets().add(getClass().getResource("GUIStyle.css").toExternalForm());
//show the stage
primaryStage.setScene(scene);
primaryStage.setTitle("oop project group 43");
primaryStage.show();
}
}

6
src/GUI/LoginStyle.css Normal file
View File

@@ -0,0 +1,6 @@
.root {
-fx-background-color: #91daff;
}
#usertext {
-fx-text-fill: #670eed;
}