Beispiel #1
0
  public void mouseExited(MouseEvent e) {
    super.mouseExited(e);

    // code to respond to mouse exiting window:
    // ------------------------------------------------------------------

    // ------------------------------------------------------------------
  }
Beispiel #2
0
  public void mouseReleased(MouseEvent e) {
    super.mouseReleased(e);

    // code to respond to mouse button released:
    // ------------------------------------------------------------------

    // ------------------------------------------------------------------
  }
Beispiel #3
0
  public void mousePressed(MouseEvent e) {
    super.mousePressed(e);

    // code to respond to mouse button pressed:
    // ------------------------------------------------------------------

    // ------------------------------------------------------------------
  }
Beispiel #4
0
  public void mouseClicked(MouseEvent e) {
    super.mouseClicked(e);

    // code to respond to mouse click:
    // ------------------------------------------------------------------

    // ------------------------------------------------------------------
  }
Beispiel #5
0
  public void mouseDragged(MouseEvent e) {
    super.mouseDragged(e);

    // code to respond to mouse motion with a button pressed:
    // ------------------------------------------------------------------

    // ------------------------------------------------------------------
  }
Beispiel #6
0
  public void mouseMoved(MouseEvent e) {
    super.mouseMoved(e);

    // code to respond to mouse motion:
    // ------------------------------------------------------------------

    // ------------------------------------------------------------------
  }
Beispiel #7
0
  public TreeViewer(String title, int ulx, int uly, int pw, int ph) {
    super(title, ulx, uly, pw, ph);

    // code to initialize instance variables before animation begins:
    // ------------------------------------------------------------------

    state = "regular";

    spread = 1;
    levelHeight = 10; // 10 levels for the camera region height

    tree = new SackBST();
    String fileName = FileBrowser.chooseFile(true);

    try {
      Scanner input = new Scanner(new File(fileName));
      String s;

      while (input.hasNext()) {
        s = input.nextLine();
        if (s != null) {
          tree.add(s);
        }
      }

      input.close();
    } catch (Exception e) {
      System.out.println("File load failed");
      System.exit(1);
    }

    // code to finish setting up entire window:
    // ------------------------------------------------------------------

    setBackgroundColor(new Color(128, 128, 200));

    // code to set up camera(s)
    // ------------------------------------------------------------------

    cameras.add(new Camera(10, 50, camw, camh, 0, 100, 0, new Color(255, 200, 255)));

    cameras.add(new Camera(10, 50 + camh + 10, camw, 20, 0, 100, 0, new Color(255, 255, 255)));

    // ------------------------------------------------------------------
    // start up the animation:
    super.start();
  }