display.java

来自「一个TSP问题的图形演示程序」· Java 代码 · 共 59 行

JAVA
59
字号
/* *  This code is from the book: * *    Winder, R and Roberts, G (2000) Developing Java *    Software, second edition, John Wiley & Sons. * *  It is copyright (c) 2000 Russel Winder and Graham Roberts. */package SimFrameWork ;/** *  Abstract Display class for rendering grids. * *  @version 2.0 March 1999 *  @author Graham Roberts */public abstract class Display {  /**   *  Create new display for a grid of given grid size.  Use x,y   *  coordinates to refer to patches.  In this abstract class the   *  width and height are given in terms of the number of patches,   *  not any graphics unit.   *   *  @param w width in patches of display.   *  @param h height in patches of display.   */  public Display(int w, int h) {    width = w ;    height = h ;  }  /**   *  Display patch at x,y with value c.   *   *  @param x patch x coordinate.   *  @param y patch y coordinate.   *  @param c value of patch to be displayed   */  public abstract void show(int x,int y,int c) ;  // The following methods should be overridden by derived classes  // but may be defined to do nothing, depending on the way the  // actual display class works.  /**   *  Clear display area so it is blank.   */  public abstract void clear() ;  /**   *  Update display to show current grid.   */  public abstract void showGrid() ;  /**   *  Display width in patches.   */  protected int width ;  /**   *  Display height in patches.   */  protected int height ;}

⌨️ 快捷键说明

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