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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build/
2,839 changes: 1,420 additions & 1,419 deletions nbproject/build-impl.xml

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions nbproject/genfiles.properties
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
build.xml.data.CRC32=6d39ee20
build.xml.script.CRC32=528642be
build.xml.stylesheet.CRC32=8064a381@1.75.1.48
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=6d39ee20
nbproject/build-impl.xml.script.CRC32=681df6e3
nbproject/build-impl.xml.stylesheet.CRC32=05530350@1.79.1.48
build.xml.data.CRC32=6d39ee20
build.xml.script.CRC32=528642be
build.xml.stylesheet.CRC32=8064a381@1.75.1.48
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=6d39ee20
nbproject/build-impl.xml.script.CRC32=5c486f47
nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48
4 changes: 2 additions & 2 deletions nbproject/private/private.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
compile.on.save=true
user.properties.file=C:\\Users\\ANDITYAARIFIANTO\\AppData\\Roaming\\NetBeans\\8.1\\build.properties
compile.on.save=true
user.properties.file=C:\\Users\\Guntur Fatmawan\\AppData\\Roaming\\NetBeans\\8.2\\build.properties
6 changes: 1 addition & 5 deletions nbproject/private/private.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
<group>
<file>file:/C:/Users/ANDITYAARIFIANTO/Documents/GitHub/Task_4/src/javaChat/ClientConnection.java</file>
<file>file:/C:/Users/ANDITYAARIFIANTO/Documents/GitHub/Task_4/src/javaChat/ServerConnection.java</file>
<file>file:/C:/Users/ANDITYAARIFIANTO/Documents/GitHub/Task_4/src/javaChat/Connection.java</file>
</group>
<group/>
</open-files>
</project-private>
146 changes: 73 additions & 73 deletions nbproject/project.properties
Original file line number Diff line number Diff line change
@@ -1,73 +1,73 @@
annotation.processing.enabled=true
annotation.processing.enabled.in.editor=false
annotation.processing.processor.options=
annotation.processing.processors.list=
annotation.processing.run.all.processors=true
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
build.classes.dir=${build.dir}/classes
build.classes.excludes=**/*.java,**/*.form
# This directory is removed when the project is cleaned:
build.dir=build
build.generated.dir=${build.dir}/generated
build.generated.sources.dir=${build.dir}/generated-sources
# Only compile against the classpath explicitly listed here:
build.sysclasspath=ignore
build.test.classes.dir=${build.dir}/test/classes
build.test.results.dir=${build.dir}/test/results
# Uncomment to specify the preferred debugger connection transport:
#debug.transport=dt_socket
debug.classpath=\
${run.classpath}
debug.test.classpath=\
${run.test.classpath}
# Files in build.classes.dir which should be excluded from distribution jar
dist.archive.excludes=
# This directory is removed when the project is cleaned:
dist.dir=dist
dist.jar=${dist.dir}/Task_4.jar
dist.javadoc.dir=${dist.dir}/javadoc
excludes=
includes=**
jar.compress=false
javac.classpath=
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false
javac.processorpath=\
${javac.classpath}
javac.source=1.8
javac.target=1.8
javac.test.classpath=\
${javac.classpath}:\
${build.classes.dir}
javac.test.processorpath=\
${javac.test.classpath}
javadoc.additionalparam=
javadoc.author=false
javadoc.encoding=${source.encoding}
javadoc.noindex=false
javadoc.nonavbar=false
javadoc.notree=false
javadoc.private=false
javadoc.splitindex=true
javadoc.use=true
javadoc.version=false
javadoc.windowtitle=
main.class=task.Task
manifest.file=manifest.mf
meta.inf.dir=${src.dir}/META-INF
mkdist.disabled=false
platform.active=default_platform
run.classpath=\
${javac.classpath}:\
${build.classes.dir}
# Space-separated list of JVM arguments used when running the project.
# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
# To set system properties for unit tests define test-sys-prop.name=value:
run.jvmargs=
run.test.classpath=\
${javac.test.classpath}:\
${build.test.classes.dir}
source.encoding=UTF-8
src.dir=src
test.src.dir=test
annotation.processing.enabled=true
annotation.processing.enabled.in.editor=false
annotation.processing.processor.options=
annotation.processing.processors.list=
annotation.processing.run.all.processors=true
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
build.classes.dir=${build.dir}/classes
build.classes.excludes=**/*.java,**/*.form
# This directory is removed when the project is cleaned:
build.dir=build
build.generated.dir=${build.dir}/generated
build.generated.sources.dir=${build.dir}/generated-sources
# Only compile against the classpath explicitly listed here:
build.sysclasspath=ignore
build.test.classes.dir=${build.dir}/test/classes
build.test.results.dir=${build.dir}/test/results
# Uncomment to specify the preferred debugger connection transport:
#debug.transport=dt_socket
debug.classpath=\
${run.classpath}
debug.test.classpath=\
${run.test.classpath}
# Files in build.classes.dir which should be excluded from distribution jar
dist.archive.excludes=
# This directory is removed when the project is cleaned:
dist.dir=dist
dist.jar=${dist.dir}/Task_4.jar
dist.javadoc.dir=${dist.dir}/javadoc
excludes=
includes=**
jar.compress=false
javac.classpath=
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false
javac.processorpath=\
${javac.classpath}
javac.source=1.8
javac.target=1.8
javac.test.classpath=\
${javac.classpath}:\
${build.classes.dir}
javac.test.processorpath=\
${javac.test.classpath}
javadoc.additionalparam=
javadoc.author=false
javadoc.encoding=${source.encoding}
javadoc.noindex=false
javadoc.nonavbar=false
javadoc.notree=false
javadoc.private=false
javadoc.splitindex=true
javadoc.use=true
javadoc.version=false
javadoc.windowtitle=
main.class=Driver.DriveClientConsole
manifest.file=manifest.mf
meta.inf.dir=${src.dir}/META-INF
mkdist.disabled=false
platform.active=default_platform
run.classpath=\
${javac.classpath}:\
${build.classes.dir}
# Space-separated list of JVM arguments used when running the project.
# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
# To set system properties for unit tests define test-sys-prop.name=value:
run.jvmargs=
run.test.classpath=\
${javac.test.classpath}:\
${build.test.classes.dir}
source.encoding=UTF-8
src.dir=src
test.src.dir=test
50 changes: 50 additions & 0 deletions src/ConsoleApp/ConnectionThread.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package ConsoleApp;

import java.io.IOException;
import java.net.Socket;
import javaChat.Connection;

/**
*
* @author Guntur Fatmawan
*/
public class ConnectionThread extends Thread {

private Socket client;
private Connection connection;

public ConnectionThread(Socket newClient) throws IOException{
this.client = newClient;
connection = new Connection(client);
}

public void run(){
try {
connection.startChat(" Start The Chat ");
System.out.println(" ------------- ");
System.out.println(" new cilent connected ");
System.out.println(" client information ");
System.out.println(connection.getClientInformation());

String inputan;
String message;
while((inputan = connection.readStream()) != null && inputan.equals("Quit")){
message = "Client " + connection.getIpClient() + "Said : " + inputan;
System.out.println(message);
connection.sendToAll(message);
}

message = "Client from IP : " + connection.getIpClient() + "Quit the chat room";
System.out.println(message);
connection.sendToAll(message);
connection.disconnect();
} catch (Exception e) {
System.out.println("Error");
}
}
}
67 changes: 67 additions & 0 deletions src/ConsoleApp/ConsoleApplication.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package ConsoleApp;

import javaChat.ClientConnection;

/**
*
* @author Guntur Fatmawan
*/
public class ConsoleApplication {

private ClientConnection client;

public class ReadInput extends Thread{

public void run(){

try {
String inputKeyboard;
do {
System.out.println(">> ");
inputKeyboard = client.inputString();
client.writeStream(inputKeyboard);
} while(!inputKeyboard.equals("Quit"));
client.disconnect();
} catch (Exception e) {
System.out.println("Error");
}
}
}

public class WriteInput extends Thread{

public void run(){

try {
String inputan;
while ((inputan = client.readStream()) != null){
System.out.println(inputan);
System.out.println(">>");
}
} catch (Exception e) {
System.out.println("Error");
}
}
}

public void startChat(){
try {
client = new ClientConnection();
System.out.println("Input server IP : ");
String ip = client.inputString();
client.connect(ip);
ReadInput in = new ReadInput();
WriteInput out = new WriteInput();
in.start();
out.start();
} catch (Exception e) {
System.out.println("Error");
}
}
}

21 changes: 21 additions & 0 deletions src/Driver/DriveClientConsole.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package Driver;

import ConsoleApp.ConsoleApplication;

/**
*
* @author Guntur Fatmawan
*/
public class DriveClientConsole {

public static void main(String[] args) {

ConsoleApplication ca = new ConsoleApplication();
ca.startChat();
}
}
20 changes: 20 additions & 0 deletions src/Driver/DriverClientGui.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package Driver;

import chatGUI.JChatController;

/**
*
* @author Guntur Fatmawan
*/
public class DriverClientGui {

public static void main(String[] args) {

JChatController jcc = new JChatController();
}
}
31 changes: 31 additions & 0 deletions src/Driver/DriverServer.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package Driver;

import ConsoleApp.ConnectionThread;
import javaChat.ServerConnection;

/**
*
* @author Guntur Fatmawan
*/
public class DriverServer {

public static void main(String[] args) {

try {
ServerConnection server = new ServerConnection();
System.out.println("Server Information");
System.out.println(server.getServerInformation());
while (true) {
ConnectionThread connection = new ConnectionThread(server.getClient());
connection.start();
}
} catch (Exception e) {
System.out.println("Error");
}
}
}
Loading