public void readState(InputStream instream) throws IOException { DataInputStream in=new DataInputStream(instream); Map<Point,Color> new_state=new HashMap<>(); int num=in.readInt(); Point point; Color col; for(int i=0; i < num; i++) { point=new Point(in.readInt(), in.readInt()); col=new Color(in.readInt()); new_state.put(point, col); } synchronized(state) { state.clear(); state.putAll(new_state); System.out.println("read state: " + state.size() + " entries"); createOffscreenImage(true); } }
public DrawPanel(boolean use_state) { if(use_state) state=new LinkedHashMap<>(); else state=null; createOffscreenImage(false); addMouseMotionListener(this); addComponentListener(new ComponentAdapter() { public void componentResized(ComponentEvent e) { if(getWidth() <= 0 || getHeight() <= 0) return; createOffscreenImage(false); } }); }
public void readState(InputStream instream) throws IOException { DataInputStream in=new DataInputStream(instream); Map<Point,Color> new_state=new HashMap<>(); int num=in.readInt(); Point point; Color col; for(int i=0; i < num; i++) { point=new Point(in.readInt(), in.readInt()); col=new Color(in.readInt()); new_state.put(point, col); } synchronized(state) { state.clear(); state.putAll(new_state); System.out.println("read state: " + state.size() + " entries"); createOffscreenImage(true); } }
public DrawPanel(boolean use_state) { if(use_state) state=new LinkedHashMap<>(); else state=null; createOffscreenImage(false); addMouseMotionListener(this); addComponentListener(new ComponentAdapter() { public void componentResized(ComponentEvent e) { if(getWidth() <= 0 || getHeight() <= 0) return; createOffscreenImage(false); } }); }
public void componentResized(ComponentEvent e) { if(getWidth() <= 0 || getHeight() <= 0) return; createOffscreenImage(false); } });
public void componentResized(ComponentEvent e) { if(getWidth() <= 0 || getHeight() <= 0) return; createOffscreenImage(false); } });