@SuppressWarnings("unchecked") public void setState(byte[] buf) { synchronized (state) { try { Map<Point, Color> tmp = (Map<Point, Color>) Util.objectFromByteBuffer(buf); state.clear(); state.putAll(tmp); System.out.println( "received state: " + buf.length + " bytes, " + state.size() + " entries"); createOffscreenImage(true); } catch (Exception e) { e.printStackTrace(); } } }