Commit 9b3bab9e authored by Darwin's avatar Darwin
Browse files

fixed aneh2

parent 5087df83
compile.on.save=true
<<<<<<< HEAD
user.properties.file=C:\\Users\\user\\AppData\\Roaming\\NetBeans\\8.0\\build.properties
=======
user.properties.file=C:\\Users\\user\\AppData\\Roaming\\NetBeans\\8.0\\build.properties
>>>>>>> 43e41c8c08f84039568ca701a584f38f9911e548
user.properties.file=C:\\Users\\Stephen\\AppData\\Roaming\\NetBeans\\8.0.2\\build.properties
\ No newline at end of file
......@@ -3,8 +3,13 @@
<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>
<<<<<<< HEAD
<file>file:/E:/semester%206/Sistem%20Paralel%20dan%20Terdistribusi/SISTER/IF3230-Tugas-Besar-Sister-2015/src/client/src/tcpclient/TCPClient.java</file>
<file>file:/E:/semester%206/Sistem%20Paralel%20dan%20Terdistribusi/SISTER/IF3230-Tugas-Besar-Sister-2015/src/client/src/tcpclient/MainPage.java</file>
=======
<file>file:/C:/Users/Stephen/Documents/NetBeansProjects/TubesSister/src/client/src/tcpclient/TCPClient.java</file>
<file>file:/C:/Users/Stephen/Documents/NetBeansProjects/TubesSister/src/client/src/tcpclient/MainPage.java</file>
>>>>>>> 6ee3636e215ce68e8e6c04438b47fa355e8396b2
</group>
</open-files>
</project-private>
......@@ -56,7 +56,7 @@ javadoc.splitindex=true
javadoc.use=true
javadoc.version=false
javadoc.windowtitle=
main.class=tcpclient.LoginPage
main.class=tcpclient.MainPage
manifest.file=manifest.mf
meta.inf.dir=${src.dir}/META-INF
mkdist.disabled=false
......
......@@ -281,43 +281,43 @@ public class LoginPage extends javax.swing.JFrame {
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(LoginPage.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(LoginPage.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(LoginPage.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(LoginPage.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
LoginPage LP=new LoginPage();
LP.setVisible(true);
}
});
}
// public static void main(String args[]) {
// /* Set the Nimbus look and feel */
// //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
// /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
// * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
// */
// try {
// for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
// if ("Nimbus".equals(info.getName())) {
// javax.swing.UIManager.setLookAndFeel(info.getClassName());
// break;
// }
// }
// } catch (ClassNotFoundException ex) {
// java.util.logging.Logger.getLogger(LoginPage.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
// } catch (InstantiationException ex) {
// java.util.logging.Logger.getLogger(LoginPage.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
// } catch (IllegalAccessException ex) {
// java.util.logging.Logger.getLogger(LoginPage.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
// } catch (javax.swing.UnsupportedLookAndFeelException ex) {
// java.util.logging.Logger.getLogger(LoginPage.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
// }
// //</editor-fold>
//
// /* Create and display the form */
// java.awt.EventQueue.invokeLater(new Runnable() {
// public void run() {
// LoginPage LP=new LoginPage();
// LP.setVisible(true);
//
//
//
//
//
// }
// });
// }
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel backLabel;
......
This diff is collapsed.
This diff is collapsed.
package tcpclient;
import javax.swing.ImageIcon;
import javax.swing.table.AbstractTableModel;
public class MapTableModel extends AbstractTableModel{
private Object[][] data;
private int dimX;
private int dimY;
private ImageIcon playerIcon;
public MapTableModel() {
dimX=0;
dimY=0;
}
public MapTableModel(int x, int y) {
dimX=x;
dimY=y;
data=new Object [x][y];
for(int i=0; i<y ;i++ ){
for(int j=0;j<x;j++)
{
data[i][j] = "";
}
}
// ClassLoader cldr = this.getClass().getClassLoader();
// java.net.URL imageURL = cldr.getResource("images/player.png");
// playerIcon = new ImageIcon(imageURL);
}
@Override
public int getRowCount() {
return dimY;
}
@Override
public int getColumnCount() {
return dimX;
}
@Override
public Object getValueAt(int rowIndex, int columnIndex) {
return data[rowIndex][columnIndex];
}
public void setValueAt(Object value, int row, int col) {
data[row][col] = "playerIcon";
fireTableCellUpdated(row, col);
}
}
......@@ -147,6 +147,20 @@ public class TCPClient {
return obj;
}
public JSONObject cancelofferJSON(String token, String offer_token) {
JSONObject obj = new JSONObject();
try {
obj.put("method", "canceloffer");
obj.put("token", token);
obj.put("offer_token", offer_token);
} catch(Exception e) {
e.printStackTrace();
}
return obj;
}
public JSONObject register(String username, String password) throws Exception
{
System.out.println("Register");
......@@ -239,7 +253,7 @@ public class TCPClient {
return responseJSON;
}
public JSONObject map(String token) throws Exception
public JSONObject map() throws Exception
{
System.out.println("Map");
String toSend = mapJSON(token).toString();
......@@ -320,7 +334,7 @@ public class TCPClient {
outToServer.writeBytes(toSend + '\n');
} catch (IOException ex) {
Logger.getLogger(TCPClient.class.getName()).log(Level.SEVERE, null, ex);
throw new Exception("outtoserver move exception");
throw new Exception("outtoserver field exception");
}
//ambil balasan server
......@@ -331,6 +345,29 @@ public class TCPClient {
return responseJSON;
}
public JSONObject canceloffer(String token, String offer_token) throws Exception
{
System.out.println("Cancel Offer");
String toSend = cancelofferJSON(token, offer_token).toString();
//throw ioexception
DataOutputStream outToServer;
try {
outToServer = new DataOutputStream(clientSocket.getOutputStream());
outToServer.writeBytes(toSend + '\n');
} catch (IOException ex) {
Logger.getLogger(TCPClient.class.getName()).log(Level.SEVERE, null, ex);
throw new Exception("outtoserver canceloffer exception");
}
//ambil balasan server
BufferedReader inFromServer = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
String response = inFromServer.readLine();
JSONObject responseJSON = new JSONObject(response);
return responseJSON;
}
// public static void main(String argv[]) throws Exception
// {
// TCPClient client = new TCPClient("localhost", 6789);
......@@ -444,7 +481,7 @@ public class TCPClient {
// }
// System.out.println(response.toString());
//
// response = client.map(client.token);
// response = client.map();
// System.out.println(response.toString());
//
// response = client.field(client.token);
......@@ -452,5 +489,8 @@ public class TCPClient {
//
// response = client.offer(client.token, 0, 1, 7, 3);
// System.out.println(response.toString());
//
// response = client.canceloffer(client.token, "a");
// System.out.println(response.toString());
// }
}
#Sun, 19 Apr 2015 16:30:46 +0700
C\:\\Users\\Stephen\\Documents\\NetBeansProjects\\TubesSister\\src\\server=
========================
BUILD OUTPUT DESCRIPTION
========================
When you build an Java application project that has a main class, the IDE
automatically copies all of the JAR
files on the projects classpath to your projects dist/lib folder. The IDE
also adds each of the JAR files to the Class-Path element in the application
JAR files manifest file (MANIFEST.MF).
To run the project from the command line, go to the dist folder and
type the following:
java -jar "TCPServer.jar"
To distribute this project, zip up the dist folder (including the lib folder)
and distribute the ZIP file.
Notes:
* If two JAR files on the project classpath have the same name, only the first
JAR file is copied to the lib folder.
* Only JAR files are copied to the lib folder.
If the classpath contains other types of files or folders, these files (folders)
are not copied.
* If a library on the projects classpath also has a Class-Path element
specified in the manifest,the content of the Class-Path element has to be on
the projects runtime path.
* To set a main class in a standard Java project, right-click the project node
in the Projects window and choose Properties. Then click Run and enter the
class name in the Main Class field. Alternatively, you can manually type the
class name in the manifest Main-Class element.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment