Beispiel #1
0
  public void PlaneNew(Plane p) {
    if (ATC.debug_flag) System.out.println("p.n.1");
    UIPlane uiplane = new UIPlane();
    char id = p.getIdChar();
    uiplane.radar_label = null;
    uiplane.info_label = new Label((new Character(id)).toString());
    if (ATC.debug_flag) System.out.println("p.n.2");
    infoArea.add(uiplane.info_label);
    if (ATC.debug_flag) System.out.println("p.n.2.1");
    infoArea.validate();
    if (ATC.debug_flag) System.out.println("p.n.3");
    synchronized (this) {
      planes.put((Object) (new Character(id)), (Object) uiplane);
    }

    if (ATC.debug_flag) System.out.println("p.n.4");
    PlaneUpdate(p);
    if (ATC.debug_flag) System.out.println("p.n.5");
  }
Beispiel #2
0
  public void PlaneUpdate(Plane p) {
    if (ATC.debug_flag) System.out.println("p.u.1");
    char id = p.getIdChar();
    UIPlane uiplane = null;
    synchronized (this) {
      uiplane = (UIPlane) (planes.get((Object) (new Character(id))));
    }
    if (ATC.debug_flag) System.out.println("p.u.1 il=" + uiplane.info_label);
    if (uiplane == null) return;
    if (ATC.debug_flag) System.out.println("p.u.2");

    if (p.takeoff_flag) {
      if (uiplane.radar_label == null) {
        if (ATC.debug_flag) System.out.println("p.u.3");
        uiplane.radar_label = new JLabel(getPlaneText(p), dirToPlaneIcon(p.dir), JLabel.CENTER);
        uiplane.radar_label.setVerticalTextPosition(JLabel.TOP);
        uiplane.radar_label.setHorizontalTextPosition(JLabel.CENTER);
        uiplane.radar_label.setIconTextGap(text_gap);
        uiplane.radar_label.setForeground(text_color);
        radarArea.add(uiplane.radar_label, new Integer(2));
        if (ATC.debug_flag) System.out.println("p.u.4");
      } else {
        if (ATC.debug_flag) System.out.println("p.u.5");
        uiplane.radar_label.setText(getPlaneText(p));
        uiplane.radar_label.setIcon(dirToPlaneIcon(p.dir));
        if (ATC.debug_flag) System.out.println("p.u.6");
      }

      uiplane.radar_label.setBounds(
          convPos(p.pos.x) - plane_width / 2,
          convPos(p.pos.y) - plane_height + icon_size / 2,
          plane_width,
          plane_height);
      if (ATC.debug_flag) System.out.println("p.u.7");
    }

    uiplane.info_label.setText(getPlaneInfoText(p));
    if (ATC.debug_flag) System.out.println("p.u.8");
    infoArea.validate();

    if (ATC.debug_flag) System.out.println("p.u.9");
  }