Ejemplo n.º 1
0
  public void mousePressed(MouseEvent e) {
    System.out.println("mousePressed");
    Point1 p2;
    switch (toolFlag) {
      case 3: // 直线
        x = (int) e.getX();
        y = (int) e.getY();
        p2 = new Point1(x, y, c, toolFlag, con);
        paintInfo.addElement(p2);
        break;

      case 4: // 圆
        x = (int) e.getX();
        y = (int) e.getY();
        p2 = new Point1(x, y, c, toolFlag, con);
        paintInfo.addElement(p2);
        break;

      case 5: // 矩形
        x = (int) e.getX();
        y = (int) e.getY();
        p2 = new Point1(x, y, c, toolFlag, con);
        paintInfo.addElement(p2);
        break;

      default:
    }
  }
Ejemplo n.º 2
0
  public void mouseDragged(MouseEvent e) {
    System.out.println("mouseDragged");
    Point1 p1;
    switch (toolFlag) {
      case 0: // 画笔
        x = (int) e.getX();
        y = (int) e.getY();
        p1 = new Point1(x, y, c, toolFlag, con);
        paintInfo.addElement(p1);
        repaint();
        break;

      case 1: // 橡皮
        x = (int) e.getX();
        y = (int) e.getY();
        p1 = new Point1(x, y, null, toolFlag, Econ);
        paintInfo.addElement(p1);
        repaint();
        break;

      default:
    }
  }
Ejemplo n.º 3
0
  public void mouseReleased(MouseEvent e) {
    System.out.println("mouseReleased");
    Point1 p3;
    switch (toolFlag) {
      case 0: // 画笔
        paintInfo.addElement(cutflag);
        break;

      case 1: // eraser
        paintInfo.addElement(cutflag);
        break;

      case 3: // 直线
        x = (int) e.getX();
        y = (int) e.getY();
        p3 = new Point1(x, y, c, toolFlag, con);
        paintInfo.addElement(p3);
        paintInfo.addElement(cutflag);
        repaint();
        break;

      case 4: // 圆
        x = (int) e.getX();
        y = (int) e.getY();
        p3 = new Point1(x, y, c, toolFlag, con);
        paintInfo.addElement(p3);
        paintInfo.addElement(cutflag);
        repaint();
        break;

      case 5: // 矩形
        x = (int) e.getX();
        y = (int) e.getY();
        p3 = new Point1(x, y, c, toolFlag, con);
        paintInfo.addElement(p3);
        paintInfo.addElement(cutflag);
        repaint();
        break;

      default:
    }
  }