示例#1
0
  /**
   * Detach a previously attached Axis.
   *
   * @param the Axis to dettach.
   */
  public void detachAxis(Axis a) {

    if (a != null) {
      a.detachAll();
      a.g2d = null;
      axis.removeElement(a);
    }
  }
示例#2
0
  /**
   * Attach a previously created Axis. Only Axes that have been attached will be drawn
   *
   * @param the Axis to attach.
   */
  public void attachAxis(Axis a) {

    if (a == null) return;

    try {
      axis.addElement(a);
      a.g2d = this;
    } catch (Exception e) {
      System.out.println("Failed to attach Axis");
      e.printStackTrace();
    }
  }
示例#3
0
  /**
   * Create and attach an Axis to the graph. The position of the axis is one of Axis.TOP,
   * Axis.BOTTOM, Axis.LEFT or Axis.RIGHT.
   *
   * @param position Position of the axis in the drawing window.
   */
  public Axis createAxis(int position) {
    Axis a;

    try {
      a = new Axis(position);
      a.g2d = this;
      axis.addElement(a);
    } catch (Exception e) {
      System.out.println("Failed to create Axis");
      e.printStackTrace();
      return null;
    }

    return a;
  }