예제 #1
0
  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);
    }
  }
예제 #2
0
    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);
      }
    }