⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 runway.java

📁 一个飞机调度员模拟训练程序,可以添加跑道数量,控制飞机飞行的速度.默认的密码可以在AtcSystem类里面修改,其中内置了三个用户名.这套系统是我和几个国外同学合力开发的,希望对大家有帮助
💻 JAVA
字号:
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.lang.InterruptedException;
import java.awt.geom.Line2D.Float;
/**
 * A simulated runway.
 * 
 * @author James M. Clarke  
 * @version 02/03/2007
 */
public class Runway
{
    // instance variables - replace the example below with your own
    private Position start;
    private Position end;
    private float angle;
    private String name;

    /**
	 * Constructor for Runway objects
	 * @param  where  the starting point of the runway, that is, the point at which planes approaching it must pass through
	 * @param  direction  the direction in which the runway points, in radians clockwise from the y-axis
	 */
    public Runway(Position where, float direction, String inName)
    {       
        start = where;
        angle = direction;
        end = Position.atAngleDistance(start, angle, 30);
        name = inName;
    }

    /**
     * Draws the runway so it can be displayed
     * 
     * @param  graphic a Graphics2D to draw the runway onto
     */
    public void draw(Graphics2D graphic)
    {
            // Draw on the runway
            graphic.draw( new java.awt.geom.Line2D.Float( start.getX(), start.getY(), end.getX(), end.getY()) );
    }

     /**
	 * Accessor method for the position of the start of the runway
	 * 
	 * @return     Position of the start of the runway
	 */    
    public Position getPosition()
    {
        return start;
    }

     /**
	 * Accessor method for the position of the end of the runway
	 * 
	 * @return     Position of the end of the runway
	 */    
    public Position getEnd()
    {
        return end;
    }

     /**
	 * Accessor method for the angle in which the runway points
	 * 
	 * @return     Angle in which the runway points, in radians clockwise from the y-axis
	 */      
    public float getAngle()
    {
        return angle;
    }

    
     /**
	 * Accessor method for the angle in which the runway points
	 * 
	 * @return     Angle in which the runway points, in radians clockwise from the y-axis
	 */      
    public String getName()
    {
        return name;
    }
    
     /**
	 * Accessor method for the angle in which the runway points
	 * 
	 * @return     Angle in which the runway points, in radians clockwise from the y-axis
	 */      
    public String toString()
    {
        return name;
    }    
    
    
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -