Commit 9eeb5ae6 authored by adwisatya's avatar adwisatya
Browse files
parents cbea3610 ee77c18d
...@@ -26,7 +26,7 @@ user.properties.file=C:\\Users\\Muldani\\AppData\\Roaming\\NetBeans\\8.0\\build. ...@@ -26,7 +26,7 @@ user.properties.file=C:\\Users\\Muldani\\AppData\\Roaming\\NetBeans\\8.0\\build.
<<<<<<< HEAD <<<<<<< HEAD
user.properties.file=C:\\Users\\A450LC W8\\AppData\\Roaming\\NetBeans\\8.0.1\\build.properties user.properties.file=C:\\Users\\A450LC W8\\AppData\\Roaming\\NetBeans\\8.0.1\\build.properties
======= =======
user.properties.file=C:\\Users\\adwisatya\\AppData\\Roaming\\NetBeans\\8.0.2\\build.properties user.properties.file=C:\\Users\\Muldani\\AppData\\Roaming\\NetBeans\\8.0\\build.properties
>>>>>>> 02323e945e52f7a247d213f954c360232adc5b0e >>>>>>> 02323e945e52f7a247d213f954c360232adc5b0e
>>>>>>> 43edd7f388dc28ed09074436ded7167fffce2bcf >>>>>>> 43edd7f388dc28ed09074436ded7167fffce2bcf
>>>>>>> 08b39e9ffc058e8856fd1186a9d3fbe46d951054 >>>>>>> 08b39e9ffc058e8856fd1186a9d3fbe46d951054
......
...@@ -3,6 +3,17 @@ ...@@ -3,6 +3,17 @@
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/> <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"> <open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
<group> <group>
<<<<<<< HEAD
<file>file:/F:/z~edo/Kuliah/Semester%206/IF3230%20Sistem%20Paralel%20dan%20Terdistribusi/Tugas%20Akhir/src/client/TheAlchemistClient/src/thealchemist/gui/AlcMixItem.java</file>
<file>file:/F:/z~edo/Kuliah/Semester%206/IF3230%20Sistem%20Paralel%20dan%20Terdistribusi/Tugas%20Akhir/src/client/TheAlchemistClient/src/thealchemist/gui/AlcLogon.java</file>
<file>file:/F:/z~edo/Kuliah/Semester%206/IF3230%20Sistem%20Paralel%20dan%20Terdistribusi/Tugas%20Akhir/src/client/TheAlchemistClient/src/thealchemist/gui/AlcMap.java</file>
<file>file:/F:/z~edo/Kuliah/Semester%206/IF3230%20Sistem%20Paralel%20dan%20Terdistribusi/Tugas%20Akhir/src/client/TheAlchemistClient/src/thealchemist/gui/AlcFindItem.java</file>
<file>file:/F:/z~edo/Kuliah/Semester%206/IF3230%20Sistem%20Paralel%20dan%20Terdistribusi/Tugas%20Akhir/src/client/TheAlchemistClient/src/thealchemist/engine/Main.java</file>
<file>file:/F:/z~edo/Kuliah/Semester%206/IF3230%20Sistem%20Paralel%20dan%20Terdistribusi/Tugas%20Akhir/src/client/TheAlchemistClient/src/thealchemist/gui/AlcTradeBox.java</file>
<file>file:/F:/z~edo/Kuliah/Semester%206/IF3230%20Sistem%20Paralel%20dan%20Terdistribusi/Tugas%20Akhir/src/client/TheAlchemistClient/src/thealchemist/gui/AlcItem.java</file>
<file>file:/F:/z~edo/Kuliah/Semester%206/IF3230%20Sistem%20Paralel%20dan%20Terdistribusi/Tugas%20Akhir/src/client/TheAlchemistClient/src/thealchemist/engine/Response.java</file>
<file>file:/F:/z~edo/Kuliah/Semester%206/IF3230%20Sistem%20Paralel%20dan%20Terdistribusi/Tugas%20Akhir/src/client/TheAlchemistClient/src/thealchemist/engine/Connection.java</file>
=======
<file>file:/C:/Users/adwisatya/Documents/Semester%206/Tugas/IF3230%20Sister/IF3230-Tugas-Besar-Sister-2015/src/client/TheAlchemistClient/src/thealchemist/gui/AlcOffer.java</file> <file>file:/C:/Users/adwisatya/Documents/Semester%206/Tugas/IF3230%20Sister/IF3230-Tugas-Besar-Sister-2015/src/client/TheAlchemistClient/src/thealchemist/gui/AlcOffer.java</file>
<file>file:/C:/Users/adwisatya/Documents/Semester%206/Tugas/IF3230%20Sister/IF3230-Tugas-Besar-Sister-2015/src/client/TheAlchemistClient/src/thealchemist/gui/AlcItem.java</file> <file>file:/C:/Users/adwisatya/Documents/Semester%206/Tugas/IF3230%20Sister/IF3230-Tugas-Besar-Sister-2015/src/client/TheAlchemistClient/src/thealchemist/gui/AlcItem.java</file>
<file>file:/C:/Users/adwisatya/Documents/Semester%206/Tugas/IF3230%20Sister/IF3230-Tugas-Besar-Sister-2015/src/client/TheAlchemistClient/src/thealchemist/gui/AlcFindItem.java</file> <file>file:/C:/Users/adwisatya/Documents/Semester%206/Tugas/IF3230%20Sister/IF3230-Tugas-Besar-Sister-2015/src/client/TheAlchemistClient/src/thealchemist/gui/AlcFindItem.java</file>
...@@ -14,6 +25,7 @@ ...@@ -14,6 +25,7 @@
<file>file:/C:/Users/adwisatya/Documents/Semester%206/Tugas/IF3230%20Sister/IF3230-Tugas-Besar-Sister-2015/src/client/TheAlchemistClient/src/thealchemist/gui/AlcLogon.java</file> <file>file:/C:/Users/adwisatya/Documents/Semester%206/Tugas/IF3230%20Sister/IF3230-Tugas-Besar-Sister-2015/src/client/TheAlchemistClient/src/thealchemist/gui/AlcLogon.java</file>
<file>file:/C:/Users/adwisatya/Documents/Semester%206/Tugas/IF3230%20Sister/IF3230-Tugas-Besar-Sister-2015/src/client/TheAlchemistClient/src/thealchemist/gui/AlcMixItem.java</file> <file>file:/C:/Users/adwisatya/Documents/Semester%206/Tugas/IF3230%20Sister/IF3230-Tugas-Besar-Sister-2015/src/client/TheAlchemistClient/src/thealchemist/gui/AlcMixItem.java</file>
<file>file:/C:/Users/adwisatya/Documents/Semester%206/Tugas/IF3230%20Sister/IF3230-Tugas-Besar-Sister-2015/src/client/TheAlchemistClient/src/thealchemist/gui/ImagePanel.java</file> <file>file:/C:/Users/adwisatya/Documents/Semester%206/Tugas/IF3230%20Sister/IF3230-Tugas-Besar-Sister-2015/src/client/TheAlchemistClient/src/thealchemist/gui/ImagePanel.java</file>
>>>>>>> ab35a18e11b0fab1af378a1ddb185a0c486fc47b
</group> </group>
</open-files> </open-files>
</project-private> </project-private>
...@@ -7,7 +7,9 @@ package thealchemist.engine; ...@@ -7,7 +7,9 @@ package thealchemist.engine;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.BufferedWriter; import java.io.BufferedWriter;
import java.io.DataInputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.io.OutputStreamWriter; import java.io.OutputStreamWriter;
import java.io.PrintWriter; import java.io.PrintWriter;
...@@ -28,7 +30,10 @@ import org.json.JSONObject; ...@@ -28,7 +30,10 @@ import org.json.JSONObject;
public class Connection { public class Connection {
String response; String response;
String request; String request;
private static String URL = "192.168.0.107"; // private static String URL = "167.205.32.46";
// private static int defPort = 8025;
private static String URL = "localhost";
private static int defPort = 6789; private static int defPort = 6789;
private String token = "kosong"; private String token = "kosong";
...@@ -37,13 +42,16 @@ public class Connection { ...@@ -37,13 +42,16 @@ public class Connection {
Socket miniSocket = new Socket(URL,defPort); Socket miniSocket = new Socket(URL,defPort);
JSONObject obj = new JSONObject(JSON); JSONObject obj = new JSONObject(JSON);
PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(miniSocket.getOutputStream()))); PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(miniSocket.getOutputStream())));
out.println(obj); out.println(obj);
out.println(); out.println();
out.flush(); out.flush();
BufferedReader in = new BufferedReader(new InputStreamReader(miniSocket.getInputStream())); InputStream dataInputStream = new DataInputStream(miniSocket.getInputStream());
response = org.apache.commons.io.IOUtils.toString(in); InputStreamReader inputStreamReader = new InputStreamReader(dataInputStream);
BufferedReader in = new BufferedReader(inputStreamReader);
response = in.readLine();
in.close(); in.close();
return response; return response;
...@@ -73,10 +81,7 @@ public class Connection { ...@@ -73,10 +81,7 @@ public class Connection {
obj.put("username", username); obj.put("username", username);
obj.put("password", toMD5(password)); obj.put("password", toMD5(password));
String hasil = sendRequest(obj.toString()); return sendRequest(obj.toString());
System.out.println(hasil);
return hasil;
} }
public String map() throws JSONException, IOException{ public String map() throws JSONException, IOException{
......
...@@ -9,6 +9,7 @@ import java.io.IOException; ...@@ -9,6 +9,7 @@ import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import javax.swing.JOptionPane;
import org.json.JSONException; import org.json.JSONException;
import thealchemist.engine.Connection; import thealchemist.engine.Connection;
import thealchemist.engine.Response; import thealchemist.engine.Response;
...@@ -451,15 +452,23 @@ public class AlcFindItem extends javax.swing.JFrame { ...@@ -451,15 +452,23 @@ public class AlcFindItem extends javax.swing.JFrame {
}//GEN-LAST:event_btnBackActionPerformed }//GEN-LAST:event_btnBackActionPerformed
private void btnFindActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnFindActionPerformed private void btnFindActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnFindActionPerformed
String hasilrespon; String hasilRespon;
try { try {
hasilrespon = connection.sendFind(idItem); hasilRespon = connection.sendFind(idItem);
if(connection.JSONtoString("status", hasilrespon).equals("ok")){ if(connection.JSONtoString("status", hasilRespon).equals("ok")){
System.out.println("ok"); JOptionPane.showMessageDialog(this,
"Benda dapat dicari",
"Informasi",
JOptionPane.INFORMATION_MESSAGE);
dispose();
new AlcTradeItem(connection).setVisible(true);
}
else{
JOptionPane.showMessageDialog(this,
connection.JSONtoString("description", hasilRespon),
"Fail",
JOptionPane.ERROR_MESSAGE);
} }
System.out.println(connection.sendFind(idItem));
dispose();
new AlcTradeItem(connection).setVisible(true);
} catch (JSONException ex) { } catch (JSONException ex) {
Logger.getLogger(AlcFindItem.class.getName()).log(Level.SEVERE, null, ex); Logger.getLogger(AlcFindItem.class.getName()).log(Level.SEVERE, null, ex);
} catch (IOException ex) { } catch (IOException ex) {
......
...@@ -11,6 +11,7 @@ import java.io.IOException; ...@@ -11,6 +11,7 @@ import java.io.IOException;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import javax.swing.JOptionPane;
import org.json.JSONException; import org.json.JSONException;
import thealchemist.engine.Connection; import thealchemist.engine.Connection;
import thealchemist.engine.Response; import thealchemist.engine.Response;
...@@ -169,30 +170,30 @@ public class AlcLogon extends javax.swing.JFrame { ...@@ -169,30 +170,30 @@ public class AlcLogon extends javax.swing.JFrame {
try { try {
try { try {
pass = new String(txtPassword.getPassword()); pass = new String(txtPassword.getPassword());
<<<<<<< HEAD
try {
hasilRespon = respon.loginOK(connection.login(txtAccount.getText(), pass));
} catch (IOException ex) {
Logger.getLogger(AlcLogon.class.getName()).log(Level.SEVERE, null, ex);
}
=======
hasilRespon = connection.login(txtAccount.getText(), pass); hasilRespon = connection.login(txtAccount.getText(), pass);
>>>>>>> 7644cdc12ce7e4a7eaa9ccb573947bde3d34b96a
if(connection.JSONtoString("status", hasilRespon).equals("ok")){ if(connection.JSONtoString("status", hasilRespon).equals("ok")){
System.out.println("ok"); JOptionPane.showMessageDialog(this,
"Berhasil Masuk.",
"Informasi",
JOptionPane.INFORMATION_MESSAGE);
connection.setToken(connection.JSONtoString("token", hasilRespon)); connection.setToken(connection.JSONtoString("token", hasilRespon));
// go to map
dispose();
new AlcMap(connection, new Integer(connection.JSONtoString("x", hasilRespon)), new Integer(connection.JSONtoString("y", hasilRespon))).setVisible(true);
} }
else if(connection.JSONtoString("status", hasilRespon).equals("fail")){ else if(connection.JSONtoString("status", hasilRespon).equals("fail")){
System.out.println("fail"); JOptionPane.showMessageDialog(this,
connection.JSONtoString("description", hasilRespon),
"Fail",
JOptionPane.WARNING_MESSAGE);
} }
else if(connection.JSONtoString("status", hasilRespon).equals("error")){ else if(connection.JSONtoString("status", hasilRespon).equals("error")){
System.out.println("error"); JOptionPane.showMessageDialog(this,
"There's something wrong!",
"Error",
JOptionPane.ERROR_MESSAGE);
} }
// go to another map
dispose();
new AlcMap(connection, new Integer(connection.JSONtoString("x", hasilRespon)), new Integer(connection.JSONtoString("y", hasilRespon))).setVisible(true);
} catch (NoSuchAlgorithmException ex) { } catch (NoSuchAlgorithmException ex) {
Logger.getLogger(AlcLogon.class.getName()).log(Level.SEVERE, null, ex); Logger.getLogger(AlcLogon.class.getName()).log(Level.SEVERE, null, ex);
} catch (IOException ex) { } catch (IOException ex) {
...@@ -223,13 +224,22 @@ public class AlcLogon extends javax.swing.JFrame { ...@@ -223,13 +224,22 @@ public class AlcLogon extends javax.swing.JFrame {
hasilRespon = connection.signUp(txtAccount.getText(), pass); hasilRespon = connection.signUp(txtAccount.getText(), pass);
if(connection.JSONtoString("status", hasilRespon).equals("ok")){ if(connection.JSONtoString("status", hasilRespon).equals("ok")){
System.out.println("ok"); JOptionPane.showMessageDialog(this,
"Berhasil Mendaftar.",
"Informasi",
JOptionPane.INFORMATION_MESSAGE);
} }
else if(connection.JSONtoString("status", hasilRespon).equals("fail")){ else if(connection.JSONtoString("status", hasilRespon).equals("fail")){
System.out.println("fail"); JOptionPane.showMessageDialog(this,
connection.JSONtoString("description", hasilRespon),
"Fail",
JOptionPane.WARNING_MESSAGE);
} }
else{ else{
System.out.println("error"); JOptionPane.showMessageDialog(this,
"There's something wrong!",
"Error",
JOptionPane.ERROR_MESSAGE);
} }
} catch (NoSuchAlgorithmException ex) { } catch (NoSuchAlgorithmException ex) {
Logger.getLogger(AlcLogon.class.getName()).log(Level.SEVERE, null, ex); Logger.getLogger(AlcLogon.class.getName()).log(Level.SEVERE, null, ex);
......
...@@ -19,6 +19,7 @@ import java.util.logging.Logger; ...@@ -19,6 +19,7 @@ import java.util.logging.Logger;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.ImageIcon; import javax.swing.ImageIcon;
import javax.swing.JLabel; import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.Timer; import javax.swing.Timer;
import javax.swing.border.Border; import javax.swing.border.Border;
import org.json.JSONException; import org.json.JSONException;
...@@ -48,6 +49,8 @@ public class AlcMap extends javax.swing.JFrame { ...@@ -48,6 +49,8 @@ public class AlcMap extends javax.swing.JFrame {
// postition // postition
private int x = 0; private int x = 0;
private int y = 0; private int y = 0;
private Boolean isBergerak = false;
/** /**
* Creates new form AlcMap * Creates new form AlcMap
...@@ -78,6 +81,7 @@ public class AlcMap extends javax.swing.JFrame { ...@@ -78,6 +81,7 @@ public class AlcMap extends javax.swing.JFrame {
public void cekDate(Date date1, Date date2){ public void cekDate(Date date1, Date date2){
if(date1.compareTo(date2)>0){ if(date1.compareTo(date2)>0){
initMap(); initMap();
isBergerak = false;
} }
} }
...@@ -121,7 +125,6 @@ public class AlcMap extends javax.swing.JFrame { ...@@ -121,7 +125,6 @@ public class AlcMap extends javax.swing.JFrame {
private void initMap(){ private void initMap(){
try { try {
if(connection.JSONtoString("status", hasilRespon).equals("ok")){ if(connection.JSONtoString("status", hasilRespon).equals("ok")){
System.out.println("ok");
lblMap.setText(connection.JSONtoString("name", hasilRespon)); lblMap.setText(connection.JSONtoString("name", hasilRespon));
lblPosition.setText("("+ getPosX() +","+ getPosY() +")"); lblPosition.setText("("+ getPosX() +","+ getPosY() +")");
...@@ -143,7 +146,7 @@ public class AlcMap extends javax.swing.JFrame { ...@@ -143,7 +146,7 @@ public class AlcMap extends javax.swing.JFrame {
for (int col = 0; col < cols; col++) { for (int col = 0; col < cols; col++) {
labels[row][col] = new JLabel(); labels[row][col] = new JLabel();
if((row == getPosX()) && (col == getPosY())){ if((row == getPosX()) && (col == getPosY())){
if(dateCurrent.compareTo(dateMove)<0){ if(isBergerak){
labels[row][col].setIcon(new ImageIcon(getClass().getResource("/thealchemist/img/mami_run.gif"))); labels[row][col].setIcon(new ImageIcon(getClass().getResource("/thealchemist/img/mami_run.gif")));
} }
else{ else{
...@@ -380,8 +383,11 @@ public class AlcMap extends javax.swing.JFrame { ...@@ -380,8 +383,11 @@ public class AlcMap extends javax.swing.JFrame {
Long timeX; Long timeX;
hasilRespon = connection.move(posX, posY); hasilRespon = connection.move(posX, posY);
if(connection.JSONtoString("status", hasilRespon).equals("ok")){ if(connection.JSONtoString("status", hasilRespon).equals("ok")){
System.out.println("ok"); isBergerak = true;
JOptionPane.showMessageDialog(this,
"Bergerak ke ("+posX+","+posY+")",
"Berhasil",
JOptionPane.INFORMATION_MESSAGE);
timeX = new Long(connection.JSONtoString("time", hasilRespon)); timeX = new Long(connection.JSONtoString("time", hasilRespon));
timeX = timeX * 1000; timeX = timeX * 1000;
...@@ -395,14 +401,19 @@ public class AlcMap extends javax.swing.JFrame { ...@@ -395,14 +401,19 @@ public class AlcMap extends javax.swing.JFrame {
lblTime.setText(dateString+" "+time); lblTime.setText(dateString+" "+time);
System.out.println(connection.move(posX, posY));
x = posX; x = posX;
y = posY; y = posY;
//initMap(); //initMap();
}else if(connection.JSONtoString("status", hasilRespon).equals("fail")){ }else if(connection.JSONtoString("status", hasilRespon).equals("fail")){
System.out.println("fail"); JOptionPane.showMessageDialog(this,
connection.JSONtoString("description", hasilRespon),
"Fail",
JOptionPane.WARNING_MESSAGE);
}else if(connection.JSONtoString("status", hasilRespon).equals("error")){ }else if(connection.JSONtoString("status", hasilRespon).equals("error")){
System.out.println("error"); JOptionPane.showMessageDialog(this,
"There's something wrong!",
"Error",
JOptionPane.ERROR_MESSAGE);
} }
} catch (JSONException ex) { } catch (JSONException ex) {
Logger.getLogger(AlcMap.class.getName()).log(Level.SEVERE, null, ex); Logger.getLogger(AlcMap.class.getName()).log(Level.SEVERE, null, ex);
...@@ -417,11 +428,17 @@ public class AlcMap extends javax.swing.JFrame { ...@@ -417,11 +428,17 @@ public class AlcMap extends javax.swing.JFrame {
hasilRespon = connection.inventory(); hasilRespon = connection.inventory();
if(connection.JSONtoString("status", hasilRespon).equals("ok")){ if(connection.JSONtoString("status", hasilRespon).equals("ok")){
JOptionPane.showMessageDialog(this,
"Melihat Inventory",
"Berhasil",
JOptionPane.INFORMATION_MESSAGE);
new AlcItem(connection).setVisible(true); new AlcItem(connection).setVisible(true);
System.out.println("ok");
} }
else{ else{
System.out.println("error"); JOptionPane.showMessageDialog(this,
"There's something wrong!",
"Error",
JOptionPane.ERROR_MESSAGE);
} }
} catch (JSONException ex) { } catch (JSONException ex) {
Logger.getLogger(AlcMap.class.getName()).log(Level.SEVERE, null, ex); Logger.getLogger(AlcMap.class.getName()).log(Level.SEVERE, null, ex);
...@@ -436,11 +453,17 @@ public class AlcMap extends javax.swing.JFrame { ...@@ -436,11 +453,17 @@ public class AlcMap extends javax.swing.JFrame {
hasilRespon = connection.inventory(); hasilRespon = connection.inventory();
if(connection.JSONtoString("status", hasilRespon).equals("ok")){ if(connection.JSONtoString("status", hasilRespon).equals("ok")){
JOptionPane.showMessageDialog(this,
"Masuk Menu Mix Item",
"Berhasil",
JOptionPane.INFORMATION_MESSAGE);
new AlcMixItem(connection).setVisible(true); new AlcMixItem(connection).setVisible(true);
System.out.println("ok");
} }
else{ else{
System.out.println("error"); JOptionPane.showMessageDialog(this,
"There's something wrong!",
"Error",
JOptionPane.ERROR_MESSAGE);
} }
} catch (JSONException ex) { } catch (JSONException ex) {
Logger.getLogger(AlcMap.class.getName()).log(Level.SEVERE, null, ex); Logger.getLogger(AlcMap.class.getName()).log(Level.SEVERE, null, ex);
...@@ -463,11 +486,17 @@ public class AlcMap extends javax.swing.JFrame { ...@@ -463,11 +486,17 @@ public class AlcMap extends javax.swing.JFrame {
hasilRespon = connection.tradeBox(); hasilRespon = connection.tradeBox();
if(connection.JSONtoString("status", hasilRespon).equals("ok")){ if(connection.JSONtoString("status", hasilRespon).equals("ok")){
JOptionPane.showMessageDialog(this,
"Melihat Trade Box",
"Berhasil",
JOptionPane.INFORMATION_MESSAGE);
new AlcTradeBox(connection).setVisible(true); new AlcTradeBox(connection).setVisible(true);
System.out.println("ok");
} }
else{ else{
System.out.println("error"); JOptionPane.showMessageDialog(this,
"There's something wrong!",
"Error",
JOptionPane.ERROR_MESSAGE);
} }
} catch (JSONException ex) { } catch (JSONException ex) {
Logger.getLogger(AlcMap.class.getName()).log(Level.SEVERE, null, ex); Logger.getLogger(AlcMap.class.getName()).log(Level.SEVERE, null, ex);
...@@ -482,14 +511,17 @@ public class AlcMap extends javax.swing.JFrame { ...@@ -482,14 +511,17 @@ public class AlcMap extends javax.swing.JFrame {
hasilRespon = connection.inventory(); hasilRespon = connection.inventory();
if(connection.JSONtoString("status", hasilRespon).equals("ok")){ if(connection.JSONtoString("status", hasilRespon).equals("ok")){
JOptionPane.showMessageDialog(this,
"Masuk Ke Menu Offer Item",
"Berhasil",
JOptionPane.INFORMATION_MESSAGE);
new AlcOffer(connection).setVisible(true); new AlcOffer(connection).setVisible(true);
System.out.println("ok");
}
else if(connection.JSONtoString("status", hasilRespon).equals("fail")){
System.out.println("fail");
} }
else if(connection.JSONtoString("status", hasilRespon).equals("error")){ else if(connection.JSONtoString("status", hasilRespon).equals("error")){
System.out.println("error"); JOptionPane.showMessageDialog(this,
"There's something wrong!",
"Error",
JOptionPane.ERROR_MESSAGE);
} }
} catch (JSONException ex) { } catch (JSONException ex) {
Logger.getLogger(AlcMap.class.getName()).log(Level.SEVERE, null, ex); Logger.getLogger(AlcMap.class.getName()).log(Level.SEVERE, null, ex);
...@@ -504,11 +536,17 @@ public class AlcMap extends javax.swing.JFrame { ...@@ -504,11 +536,17 @@ public class AlcMap extends javax.swing.JFrame {
hasilRespon = connection.inventory(); hasilRespon = connection.inventory();
if(connection.JSONtoString("status", hasilRespon).equals("ok")){ if(connection.JSONtoString("status", hasilRespon).equals("ok")){
JOptionPane.showMessageDialog(this,
"Masuk Ke menu Find Item",
"Berhasil",
JOptionPane.INFORMATION_MESSAGE);
new AlcFindItem(connection).setVisible(true); new AlcFindItem(connection).setVisible(true);
System.out.println("ok");
} }
else{ else{
System.out.println("error"); JOptionPane.showMessageDialog(this,
"There's something wrong!",
"Error",
JOptionPane.ERROR_MESSAGE);
} }
} catch (JSONException ex) { } catch (JSONException ex) {
Logger.getLogger(AlcMap.class.getName()).log(Level.SEVERE, null, ex); Logger.getLogger(AlcMap.class.getName()).log(Level.SEVERE, null, ex);
...@@ -530,11 +568,21 @@ public class AlcMap extends javax.swing.JFrame { ...@@ -530,11 +568,21 @@ public class AlcMap extends javax.swing.JFrame {
String hasilRespon; String hasilRespon;
hasilRespon = connection.field(); hasilRespon = connection.field();
if(connection.JSONtoString("status", hasilRespon).equals("ok")){ if(connection.JSONtoString("status", hasilRespon).equals("ok")){
System.out.println("ok"); JOptionPane.showMessageDialog(this,
"Berhasil didapatkan",
"Informasi",
JOptionPane.INFORMATION_MESSAGE,
connection.idToIcon(connection.JSONtoString("item", hasilRespon)));
}else if(connection.JSONtoString("status", hasilRespon).equals("fail")){ }else if(connection.JSONtoString("status", hasilRespon).equals("fail")){
System.out.println("fail"); JOptionPane.showMessageDialog(this,