FileDocCategorySizeDatePackage
RadarDisplay.javaAPI DocExample1637Sun Feb 13 17:05:24 GMT 2000None

RadarDisplay

public class RadarDisplay extends Frame implements Observer

Fields Summary
private int
screenSize
private int
halfScreen
private RadarScreen
theScreen
private Image
im
Constructors Summary
public RadarDisplay()

  setTitle( "Radar Display" );
      add( theScreen );
      pack();
      setVisible( true );
   
Methods Summary
public voidupdate(java.util.Observable o, java.lang.Object a)

                                  
          
     if( o instanceof Radar )
      {  // if( im == null )
      	// remove the comment on the previous line to see a trail of
      	// markes left on screen
         {  im = createImage( screenSize, screenSize );
         }
         Graphics g = im.getGraphics();
         g.setColor( Color.black );
         Vector v = (Vector)a;
         for( int aircraft = 0; aircraft < v.size(); aircraft++ )
         {  AircraftData ad = (AircraftData)(v.elementAt( aircraft ));
            g.drawRect( halfScreen + ad.east*halfScreen/25000, halfScreen - ad.north*halfScreen/25000, 1, 1 );
         }
         g.dispose();
         theScreen.setImage( im );
         theScreen.repaint();
          
      }