From 02cf0fc0316bbfaa3d82c1c2ac0e72575b99d632 Mon Sep 17 00:00:00 2001 From: Brandon Jackson <1drummer@att.net> Date: Tue, 3 Nov 2015 18:40:05 -0600 Subject: [PATCH 1/4] Less console, more GUI --- Client.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Client.java b/Client.java index f8b3737..d843515 100755 --- a/Client.java +++ b/Client.java @@ -1,4 +1,4 @@ -// Alex Huddleston +// Alex Huddleston & Brandon Jackson // Breakthrough Client in Java import java.io.IOException; @@ -312,7 +312,8 @@ public class Client { frame.pack(); frame.setMinimumSize(frame.getSize()); frame.setVisible(true); - userInput = stdIn.readLine(); + //userInput = stdIn.readLine(); + userInput = JOptionPane.showInputDialog(frame, temp); output.println(userInput); String diff = "?"; @@ -320,9 +321,10 @@ public class Client { temp = String.valueOf(b).trim(); System.out.print(temp); while(!diff.equals("EASY") && !diff.equals("MEDIUM") && !diff.equals("HARD")) { - diff = stdIn.readLine(); + diff = JOptionPane.showInputDialog(frame, temp);//diff = stdIn.readLine(); + diff = diff.toUpperCase(); if(!diff.equals("EASY") && !diff.equals("MEDIUM") && !diff.equals("HARD")) { - System.out.print(diff + "\nInvalid difficulty.\n" + temp); + JOptionPane.showMessageDialog(null, diff + "\nInvalid difficulty.\n" + temp); } } output.println(userInput); @@ -333,6 +335,7 @@ public class Client { in.read(buffer, 0, 256); for(int i = 0; i < buffer.length; ++i) { if(Arrays.equals(Arrays.copyOfRange(buffer, i, i+9), go)) { + JOptionPane.showMessageDialog(null, "\nGAME OVER\n"); end = true; } } @@ -369,4 +372,4 @@ public class Client { System.err.println("IOException: " + e.getMessage()); } } -} \ No newline at end of file +} From 92c2d839baaeb8eee2cf65f955e4001f2c240388 Mon Sep 17 00:00:00 2001 From: Brandon Jackson <1drummer@att.net> Date: Tue, 3 Nov 2015 18:40:49 -0600 Subject: [PATCH 2/4] Update Client.java --- Client.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Client.java b/Client.java index d843515..1ef9ac8 100755 --- a/Client.java +++ b/Client.java @@ -1,4 +1,4 @@ -// Alex Huddleston & Brandon Jackson +// Alex Huddleston // Breakthrough Client in Java import java.io.IOException; @@ -289,7 +289,7 @@ public class Client { in.read(b, 0, 256); String temp = String.valueOf(b).trim(); - System.out.print(temp); + //System.out.print(temp); //setBoard(temp); //window.drawBoard(temp); @@ -319,7 +319,7 @@ public class Client { String diff = "?"; in.read(b, 0, 256); temp = String.valueOf(b).trim(); - System.out.print(temp); + //System.out.print(temp); while(!diff.equals("EASY") && !diff.equals("MEDIUM") && !diff.equals("HARD")) { diff = JOptionPane.showInputDialog(frame, temp);//diff = stdIn.readLine(); diff = diff.toUpperCase(); From f9949ac01ea2f8c412bc54f9cf0de9e0af1a2e96 Mon Sep 17 00:00:00 2001 From: Brandon Jackson <1drummer@att.net> Date: Tue, 3 Nov 2015 19:06:20 -0600 Subject: [PATCH 3/4] Game closes on completion, more GUI --- Client.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Client.java b/Client.java index 1ef9ac8..162ac90 100755 --- a/Client.java +++ b/Client.java @@ -289,10 +289,6 @@ public class Client { in.read(b, 0, 256); String temp = String.valueOf(b).trim(); - //System.out.print(temp); - //setBoard(temp); - //window.drawBoard(temp); - String g = "GAME OVER"; char[] go = new char[9]; for(int x = 0; x < go.length; ++x) { @@ -314,6 +310,9 @@ public class Client { frame.setVisible(true); //userInput = stdIn.readLine(); userInput = JOptionPane.showInputDialog(frame, temp); + //while(!userInput.contains("1") || !userInput.contains("2")) { + // userInput = JOptionPane.showInputDialog(frame, temp); + //} output.println(userInput); String diff = "?"; @@ -335,6 +334,7 @@ public class Client { in.read(buffer, 0, 256); for(int i = 0; i < buffer.length; ++i) { if(Arrays.equals(Arrays.copyOfRange(buffer, i, i+9), go)) { + frame.dispatchEvent(new WindowEvent(frame, WindowEvent.WINDOW_CLOSING)); JOptionPane.showMessageDialog(null, "\nGAME OVER\n"); end = true; } From b517b06bc614e18b2c6252c12fcfdc1eb71fd38f Mon Sep 17 00:00:00 2001 From: Brandon Jackson <1drummer@att.net> Date: Tue, 3 Nov 2015 19:06:50 -0600 Subject: [PATCH 4/4] Game closes on completion, more GUI --- Client.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Client.java b/Client.java index 162ac90..3068028 100755 --- a/Client.java +++ b/Client.java @@ -1,4 +1,4 @@ -// Alex Huddleston +// Alex Huddleston and Brandon Jackson // Breakthrough Client in Java import java.io.IOException;