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
Empty file.
Empty file.
Binary file added build/classes/Driver/DriverClientConsole.class
Binary file not shown.
Binary file added build/classes/Driver/DriverClientGui.class
Binary file not shown.
Binary file added build/classes/Driver/DriverServer.class
Binary file not shown.
Binary file added build/classes/Model/ConnectionThread.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added build/classes/Model/ConsoleApplication.class
Binary file not shown.
Binary file added build/classes/chatGUI/ChatView$1.class
Binary file not shown.
Binary file added build/classes/chatGUI/ChatView.class
Binary file not shown.
69 changes: 69 additions & 0 deletions build/classes/chatGUI/ChatView.form
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<?xml version="1.0" encoding="UTF-8" ?>

<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
<Properties>
<Property name="defaultCloseOperation" type="int" value="3"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>

<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jScrollPane1" pref="463" max="32767" attributes="0"/>
<Component id="txFieldChat" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jScrollPane1" min="-2" pref="273" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="txFieldChat" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="18" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
<AuxValues>
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
</AuxValues>

<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JTextArea" name="txAreaChat">
<Properties>
<Property name="editable" type="boolean" value="false"/>
<Property name="columns" type="int" value="20"/>
<Property name="rows" type="int" value="5"/>
<Property name="text" type="java.lang.String" value="Input Server IP Address :"/>
</Properties>
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JTextField" name="txFieldChat">
</Component>
</SubComponents>
</Form>
Binary file not shown.
Binary file added build/classes/chatGUI/JChatController.class
Binary file not shown.
Binary file added build/classes/javaChat/ClientConnection.class
Binary file not shown.
Binary file added build/classes/javaChat/Connection.class
Binary file not shown.
Binary file added build/classes/javaChat/ServerConnection.class
Binary file not shown.
2 changes: 1 addition & 1 deletion 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
user.properties.file=C:\\Users\\DEWA\\AppData\\Roaming\\NetBeans\\8.0.2\\build.properties
2 changes: 1 addition & 1 deletion nbproject/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ javadoc.splitindex=true
javadoc.use=true
javadoc.version=false
javadoc.windowtitle=
main.class=task.Task
main.class=Driver.DriverServer
manifest.file=manifest.mf
meta.inf.dir=${src.dir}/META-INF
mkdist.disabled=false
Expand Down
14 changes: 14 additions & 0 deletions src/Driver/DriverClientConsole.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

package Driver;


import Model.ConsoleApplication;

public class DriverClientConsole {

public static void main(String[] args) {

ConsoleApplication CA = new ConsoleApplication();
CA.startChat();
}
}
14 changes: 14 additions & 0 deletions src/Driver/DriverClientGui.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

package Driver;


import chatGUI.JChatController;


public class DriverClientGui {

public static void main(String[] args) {

JChatController JCC = new JChatController();
}
}
24 changes: 24 additions & 0 deletions src/Driver/DriverServer.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@

package Driver;

import Model.ConnectionThread;
import javaChat.ServerConnection;
import java.io.IOException;

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 x) {
System.out.println("Error...");
}
}
}
47 changes: 47 additions & 0 deletions src/Model/ConnectionThread.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@

package Model;

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

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 x) {
System.out.println("Error...");
}
}
}

58 changes: 58 additions & 0 deletions src/Model/ConsoleApplication.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@

package Model;

import javaChat.ClientConnection;

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 x) {
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 x) {
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 x) {
System.out.println("Error...");
}
}
}
69 changes: 69 additions & 0 deletions src/chatGUI/ChatView.form
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<?xml version="1.0" encoding="UTF-8" ?>

<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
<Properties>
<Property name="defaultCloseOperation" type="int" value="3"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>

<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jScrollPane1" pref="463" max="32767" attributes="0"/>
<Component id="txFieldChat" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jScrollPane1" min="-2" pref="273" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="txFieldChat" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="18" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
<AuxValues>
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
</AuxValues>

<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JTextArea" name="txAreaChat">
<Properties>
<Property name="editable" type="boolean" value="false"/>
<Property name="columns" type="int" value="20"/>
<Property name="rows" type="int" value="5"/>
<Property name="text" type="java.lang.String" value="Input Server IP Address :"/>
</Properties>
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JTextField" name="txFieldChat">
</Component>
</SubComponents>
</Form>
Loading