Skip to content
Open
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
3 changes: 3 additions & 0 deletions .idea/.gitignore

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

6 changes: 6 additions & 0 deletions .idea/misc.xml

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

8 changes: 8 additions & 0 deletions .idea/modules.xml

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

10 changes: 10 additions & 0 deletions .idea/runConfigurations.xml

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

6 changes: 6 additions & 0 deletions .idea/vcs.xml

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

Binary file added Client/out/production/untitled/Client.class
Binary file not shown.
60 changes: 60 additions & 0 deletions Client/src/Client.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.Socket;
import java.net.UnknownHostException;
import java.util.Scanner;

public class Client {

static String host = "192.168.43.6";
static int port = 6969;
static DataInputStream in;
static DataOutputStream out;
static Socket socket;

public static void main(String[] args) {

Scanner input = new Scanner(System.in);
boolean connect = true;

try {
socket = new Socket(host, port);
in = new DataInputStream(socket.getInputStream());
out = new DataOutputStream(socket.getOutputStream());

//while (connect) {
/*System.out.println("Enter annual interest rate");
double annualInterestRate = input.nextDouble();

System.out.println("Enter number of years");
int numOfYears = input.nextInt();

System.out.println("Enter loan amount");
double loanAmount = input.nextDouble();

out.writeDouble(annualInterestRate);
out.writeInt(numOfYears);
out.writeDouble(loanAmount);

*/
//out.flush();

// }
while(true){
String name = input.nextLine();
out.writeUTF(name);
while(true){
String print = in.readUTF();
System.out.println(print);
}

}

} catch (UnknownHostException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
11 changes: 11 additions & 0 deletions Client/untitled.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
28 changes: 28 additions & 0 deletions GameFx/GameFx.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_17">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Maven: org.openjfx:javafx-controls:17-ea+11" level="project" />
<orderEntry type="library" name="Maven: org.openjfx:javafx-controls:mac:17-ea+11" level="project" />
<orderEntry type="library" name="Maven: org.openjfx:javafx-graphics:17-ea+11" level="project" />
<orderEntry type="library" name="Maven: org.openjfx:javafx-graphics:mac:17-ea+11" level="project" />
<orderEntry type="library" name="Maven: org.openjfx:javafx-base:17-ea+11" level="project" />
<orderEntry type="library" name="Maven: org.openjfx:javafx-base:mac:17-ea+11" level="project" />
<orderEntry type="library" name="Maven: org.openjfx:javafx-fxml:17-ea+11" level="project" />
<orderEntry type="library" name="Maven: org.openjfx:javafx-fxml:mac:17-ea+11" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-api:5.7.1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.apiguardian:apiguardian-api:1.1.0" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.opentest4j:opentest4j:1.2.0" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.junit.platform:junit-platform-commons:1.7.1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-engine:5.7.1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.junit.platform:junit-platform-engine:1.7.1" level="project" />
</component>
</module>
70 changes: 70 additions & 0 deletions GameFx/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.example</groupId>
<artifactId>GameFx</artifactId>
<version>1.0-SNAPSHOT</version>
<name>GameFx</name>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<junit.version>5.7.1</junit.version>
</properties>

<dependencies>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>17-ea+11</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>17-ea+11</version>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>17</source>
<target>17</target>
</configuration>
</plugin>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.6</version>
<executions>
<execution>
<!-- Default configuration for running with: mvn clean javafx:run -->
<id>default-cli</id>
<configuration>
<mainClass>com.example.gamefx/com.example.gamefx.HelloApplication</mainClass>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
32 changes: 32 additions & 0 deletions GameFx/src/main/java/com/example/gamefx/HelloApplication.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.example.gamefx;

import javafx.application.Application;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.stage.Stage;

import java.io.IOException;


public class HelloApplication extends Application {

@Override
public void start(Stage stage) throws IOException {
// which scene we want to be initially displayed.. load that .fxml file
FXMLLoader fxmlLoader = new FXMLLoader(HelloApplication.class.getResource("CARDS_AGAINST_MEDIALOGY.fxml"));
Scene scene = new Scene(fxmlLoader.load());
stage.setTitle("Card Game"); //the title of the window
stage.setScene(scene);
stage.show();
}

public static void main(String[] args) {
launch();
}

}


51 changes: 51 additions & 0 deletions GameFx/src/main/java/com/example/gamefx/SceneController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package com.example.gamefx;

import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.stage.Stage;

import java.io.IOException;

public class SceneController {
@FXML
private Label welcomeText;
private Stage stage;
private Scene scene;
private FXMLLoader fxmlLoader;

//https://www.youtube.com/watch?v=hcM-R-YOKkQ&ab_channel=BroCode
// method to switch scenes
@FXML
protected void onButtonClick(ActionEvent event) throws IOException {
welcomeText.setText("Welcome to JavaFX Application!");
//load the correct .fxml file
fxmlLoader = new FXMLLoader(HelloApplication.class.getResource("CARDS_AGAINST_MEDIALOGY.fxml"));
//cast the source of the event to Node, cast the entire stage to Stage
stage = (Stage)((Node)event.getSource()).getScene().getWindow();
scene = new Scene(fxmlLoader.load());
// set the scene to the stage
stage.setScene(scene);
stage.show(); //display it


}



@FXML
protected void switchToScene2(ActionEvent event) throws IOException {
fxmlLoader = new FXMLLoader(HelloApplication.class.getResource("second-page.fxml"));
stage = (Stage)((Node)event.getSource()).getScene().getWindow();
scene = new Scene(fxmlLoader.load(), 560, 440);
stage.setScene(scene);
stage.show();

}


}
8 changes: 8 additions & 0 deletions GameFx/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module com.example.gamefx {
requires javafx.controls;
requires javafx.fxml;


opens com.example.gamefx to javafx.fxml;
exports com.example.gamefx;
}
Loading