Пример #1
0
  protected void setCursor(int sideName) {
    Cursor cursor = null;

    switch (sideName) {
      case NONE:
        cursor = Cursor.getPredefinedCursor(Cursor.HAND_CURSOR);
        break;
      case NORTH:
        cursor = Cursor.getPredefinedCursor(Cursor.N_RESIZE_CURSOR);
        break;
      case SOUTH:
        cursor = Cursor.getPredefinedCursor(Cursor.S_RESIZE_CURSOR);
        break;
      case EAST:
        cursor = Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR);
        break;
      case WEST:
        cursor = Cursor.getPredefinedCursor(Cursor.W_RESIZE_CURSOR);
        break;
      case NORTHWEST:
        cursor = Cursor.getPredefinedCursor(Cursor.NW_RESIZE_CURSOR);
        break;
      case NORTHEAST:
        cursor = Cursor.getPredefinedCursor(Cursor.NE_RESIZE_CURSOR);
        break;
      case SOUTHWEST:
        cursor = Cursor.getPredefinedCursor(Cursor.SW_RESIZE_CURSOR);
        break;
      case SOUTHEAST:
        cursor = Cursor.getPredefinedCursor(Cursor.SE_RESIZE_CURSOR);
        break;
    }

    this.setCursor(cursor);
  }
Пример #2
0
  public void enable() {
    this.getShape().setStartPosition(null);

    LayerList layers = this.getWwd().getModel().getLayers();

    if (!layers.contains(this.getLayer())) layers.add(this.getLayer());

    if (!this.getLayer().isEnabled()) this.getLayer().setEnabled(true);

    this.setArmed(true);

    this.getWwd().addRenderingListener(this);
    this.getWwd().addSelectListener(this);
    this.getWwd().getInputHandler().addMouseListener(this);
    this.getWwd().getInputHandler().addMouseMotionListener(this);

    this.setCursor(Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR));
  }