tile.java
来自「利用JAVA实现的利用进化算法对人口增长进行仿真的源码」· Java 代码 · 共 45 行
JAVA
45 行
/*
* Tile.java
*
* Created on 28 November 2006, 22:36
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package wpc.data;
import java.awt.Color;
/**
*
* @author willis
*/
public class Tile {
private Color tileColor;
wpc.MainFrame mainFrame;
/** Creates a new instance of Tile */
public Tile(int height, wpc.MainFrame mainFrame){
this.mainFrame = mainFrame;
calcColor(height);
}
public Color getColor(){
return tileColor;
}
public int getColorInt(){
return tileColor.getRGB();
}
private void calcColor(int height){
if (height<mainFrame.getSeaLevel()){
tileColor = new Color(0,0,200);
}else if (height>mainFrame.getMountainLevel()){
tileColor = new Color(height,height,height);
}else{
tileColor = new Color(0,height,0);
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?