private void handleMessage(String message) {
        JSONObject data = (JSONObject) JSONValue.parse(message);
        String action = (String) data.get(Messages.type);
        if (action.equals(Messages.switchWhiteboard)) {
            newCanvas();
            SwitchWhiteboardMessage m = SwitchWhiteboardMessage.STATIC.fromJSON(data);
            model.whiteboard = new Whiteboard(m.whiteboardID, model);
            frame.setTitle("Now connected to: " + m.whiteboardID);
            return;
        } else if (action.equals(Messages.whiteboardCreated)) {
            newCanvas();
            WhiteboardCreatedMessage m = WhiteboardCreatedMessage.STATIC.fromJSON(data);
            model.whiteboard = new Whiteboard(m.whiteboardID, model);
            frame.setTitle("Now connected to: " + m.whiteboardID);
            return;
        } else if (model.whiteboard != null) {
            if (action.equals(Messages.currentUsers)) {
                UserListMessage m = UserListMessage.STATIC.fromJSON(data);
                if (m.whiteboardID.equals(model.whiteboard.whiteboardID)) {
                    setCurrentUsers(m.getUsers());
                }
            } else if (action.equals(Messages.fromServerStroke)) {
                FromServerStrokeMessage m = FromServerStrokeMessage.STATIC.fromJSON(data);
                if (m.whiteboardID.equals(model.whiteboard.whiteboardID)) {
                    model.whiteboard.addDrawableFromServer(m.id, m.drawable);
                }
            }
        }
        frame.repaint();
    }