public void sendClearPanelMsg() { DrawCommand comm = new DrawCommand(DrawCommand.CLEAR); try { byte[] buf = Util.streamableToByteBuffer(comm); if (use_unicasts) sendToAll(buf); else channel.send(new Message(null, null, buf)); } catch (Exception ex) { System.err.println(ex); } }
public void mouseDragged(MouseEvent e) { int x = e.getX(), y = e.getY(); DrawCommand comm = new DrawCommand( DrawCommand.DRAW, x, y, draw_color.getRed(), draw_color.getGreen(), draw_color.getBlue()); if (no_channel) { drawPoint(comm); return; } try { byte[] buf = Util.streamableToByteBuffer(comm); if (use_unicasts) sendToAll(buf); else channel.send(new Message(null, null, buf)); } catch (Exception ex) { System.err.println(ex); } }