Skip to content
Snippets Groups Projects
Commit 48f09be2 authored by mpriymak's avatar mpriymak
Browse files

Cleaned out the printstacktraces from the client and GUI classes.

parent 4ad6db5f
Branches master
No related tags found
No related merge requests found
No preview for this file type
......@@ -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();
......
......@@ -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
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();
}
}
......
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();
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment