public void mouseDragged(MouseEvent m) {
    if (frame.side.op != SidePanel.Operation.Pencil) return;

    int curMouseX = m.getX();
    int curMouseY = m.getY();

    if (prevMouseX != -1 && prevMouseY != -1) {
      LineSegment line =
          new LineSegment(
              prevMouseX,
              prevMouseY,
              curMouseX,
              curMouseY,
              frame.side.color.getRGB(),
              (byte) frame.side.sizeSlider.getValue());

      frame.msm.sendLineSegment(line);

      if (line.time != -1) {
        frame.p2pListener.addLineSegment(line, this);
      } else {
        DrawCommands.drawLineSegmentWithWidth(line, graphics);
      }
    }

    prevMouseX = m.getX();
    prevMouseY = m.getY();
    repaint();
  }
  public void mouseClicked(MouseEvent m) {
    int curMouseX = m.getX();
    int curMouseY = m.getY();

    LineSegment line =
        new LineSegment(
            curMouseX,
            curMouseY,
            curMouseX,
            curMouseY,
            frame.side.color.getRGB(),
            (byte) frame.side.sizeSlider.getValue());

    frame.msm.sendLineSegment(line);
    if (line.time != -1) {
      frame.p2pListener.addLineSegment(line, this);
    } else {
      DrawCommands.drawLineSegmentWithWidth(line, graphics);
    }

    repaint();
  }