diff --git a/out/production/infinitymonkeys/GUI/PaintGUI.class b/out/production/infinitymonkeys/GUI/PaintGUI.class index bdf80ef5f698d814a37a2f9388bbc28c31845266..daee65b2e541591bc7d7cc42b71c181213f8f428 100644 Binary files a/out/production/infinitymonkeys/GUI/PaintGUI.class and b/out/production/infinitymonkeys/GUI/PaintGUI.class differ diff --git a/src/GUI/DrawingArea.java b/src/GUI/DrawingArea.java index cd757c3ae7ae4729885793a14a3d760dbf791369..cc4d387d4cb8e4b33d700062969746208520d97e 100644 --- a/src/GUI/DrawingArea.java +++ b/src/GUI/DrawingArea.java @@ -126,7 +126,8 @@ public class DrawingArea extends JPanel implements MouseMotionListener, MouseLis try { ImageIO.write(image, "PNG", file); } catch (IOException e) { - e.printStackTrace(); + StartScreen.showErrorMessage("Error in saving PNG"); + //e.printStackTrace(); } } @@ -137,7 +138,8 @@ public class DrawingArea extends JPanel implements MouseMotionListener, MouseLis try { ImageIO.write(imageJPG, "JPG", file); } catch (IOException e) { - e.printStackTrace(); + StartScreen.showErrorMessage("Error in saving JPG"); + //e.printStackTrace(); } } @@ -145,7 +147,8 @@ public class DrawingArea extends JPanel implements MouseMotionListener, MouseLis try { image = ImageIO.read(file); } catch (IOException e) { - e.printStackTrace(); + StartScreen.showErrorMessage("Error in opening file"); + //e.printStackTrace(); } repaint(); } @@ -212,8 +215,7 @@ public class DrawingArea extends JPanel implements MouseMotionListener, MouseLis g2.drawString(textString, startPoint.x, startPoint.y); try { client.getDrawingController().broadcastText(client.getUserName(), textString, g2.getFont(), shapeColor, startPoint); - } catch (RemoteException ex) - { + } catch (RemoteException ex) { StartScreen.showErrorMessage("Connection with server lost"); System.exit(0); //ex.printStackTrace(); diff --git a/src/GUI/PaintGUI.java b/src/GUI/PaintGUI.java index 72d632a56234ba4ce44d0d67c050fa38b80b640b..7d06d8a9a237a7a514807f4ee5fa5119e1314352 100644 --- a/src/GUI/PaintGUI.java +++ b/src/GUI/PaintGUI.java @@ -84,7 +84,8 @@ public class PaintGUI extends JPanel { textBtn = new JButton(new ImageIcon(textIcon)); textBtn.addActionListener(actionListener); } catch (Exception e) { - e.printStackTrace(); + StartScreen.showErrorMessage("Error setting up canvas buttons"); + //e.printStackTrace(); } strokeOptions = new JComboBox(strokes); @@ -248,7 +249,8 @@ public class PaintGUI extends JPanel { baos.close(); } catch (IOException err) { - err.printStackTrace(); + StartScreen.showErrorMessage("Error writing file"); + //err.printStackTrace(); } try { @@ -419,6 +421,7 @@ public class PaintGUI extends JPanel { openBtn.setEnabled(false); saveBtn.setEnabled(false); saveAsBtn.setEnabled(false); + clearBtn.setEnabled(false); } public void enableFileControl() { @@ -426,6 +429,7 @@ public class PaintGUI extends JPanel { openBtn.setEnabled(true); saveBtn.setEnabled(true); saveAsBtn.setEnabled(true); + clearBtn.setEnabled(true); } } \ No newline at end of file diff --git a/src/client/DrawingUpdate.java b/src/client/DrawingUpdate.java index bb920065cd8235615d3fb9ad60f49bcf0b84e202..e7f4efccc1662ab0401a1a128f2b32618a0c8e9c 100644 --- a/src/client/DrawingUpdate.java +++ b/src/client/DrawingUpdate.java @@ -1,5 +1,6 @@ package client; +import GUI.StartScreen; import remote.IDrawingUpdate; import javax.swing.*; @@ -155,8 +156,10 @@ public class DrawingUpdate extends UnicastRemoteObject implements IDrawingUpdate // do whatever you wish with the image } - catch (IOException err) { - err.printStackTrace(); + catch (IOException err) + { + StartScreen.showErrorMessage("Error in receiving image"); + //err.printStackTrace(); } return true; } @@ -185,8 +188,10 @@ class removeClientTimer extends Thread { elementIndex = temp.indexOf(fromClient); temp.remove(elementIndex); } - } catch (InterruptedException e) { - e.printStackTrace(); + } catch (InterruptedException e) + { + StartScreen.showErrorMessage("Interrupted Exception"); + //e.printStackTrace(); } } diff --git a/src/client/EncryptionUpdate.java b/src/client/EncryptionUpdate.java index 52d1fa52d2f6ee065599c615ec936c707b733e24..33500cb452a6c77a573df847004eacdb0b646b32 100644 --- a/src/client/EncryptionUpdate.java +++ b/src/client/EncryptionUpdate.java @@ -1,5 +1,6 @@ package client; +import GUI.StartScreen; import remote.IDrawingUpdate; import remote.IEncryptionUpdate; @@ -35,15 +36,20 @@ public class EncryptionUpdate extends UnicastRemoteObject implements IEncryption } catch (NoSuchAlgorithmException e) { - e.printStackTrace(); + StartScreen.showErrorMessage("Shared key error"); + //e.printStackTrace(); } catch (NoSuchProviderException e) { - e.printStackTrace(); + StartScreen.showErrorMessage("Shared key error"); + //e.printStackTrace(); } catch (NoSuchPaddingException | InvalidKeyException e) { - e.printStackTrace(); + StartScreen.showErrorMessage("Shared key error"); + //e.printStackTrace(); } catch (BadPaddingException e) { - e.printStackTrace(); + StartScreen.showErrorMessage("Shared key error"); + //e.printStackTrace(); } catch (IllegalBlockSizeException e) { - e.printStackTrace(); + StartScreen.showErrorMessage("Shared key error"); + //e.printStackTrace(); } @@ -59,9 +65,8 @@ public class EncryptionUpdate extends UnicastRemoteObject implements IEncryption } catch (Exception e){ - e.printStackTrace(); + StartScreen.showErrorMessage("Encryption Update error"); + //e.printStackTrace(); } - } - }