本文整理汇总了Java中java.lang.String.valueOf方法的典型用法代码示例。如果您正苦于以下问题:Java String.valueOf方法的具体用法?Java String.valueOf怎么用?Java String.valueOf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.lang.String
的用法示例。
在下文中一共展示了String.valueOf方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setBoardSize
import java.lang.String; //导入方法依赖的package包/类
public void setBoardSize(int width,int height){
WIDTH=width;
HEIGHT=height;
if(WIDTH >20){
WIDTH = 20;
}else if(WIDTH<2){
WIDTH = 2;
}
if(HEIGHT >20){
HEIGHT = 20;
}else if(HEIGHT<2){
HEIGHT = 2;
}
allTiles = new Tile[WIDTH][HEIGHT];
if(screen==3){
removeObjects(getObjectsAt(500,150,Text.class));
String dimensions = String.valueOf(WIDTH)+"x"+String.valueOf(HEIGHT);
addObject(new Text(dimensions,30),500,150);
}else if(screen==1){
playGame();
}
}
示例2: setTimeLimit
import java.lang.String; //导入方法依赖的package包/类
public void setTimeLimit(int hours,int minutes,int seconds, int milliseconds){
timeLimit = new int[]{hours,minutes,seconds,milliseconds};
if(screen==3){
removeObjects(getObjectsAt(750,180,Text.class));
if(hours==Integer.MAX_VALUE){
addObject(new Text("Untimed",30),750,180);
}else{
String maxTimeString = String.valueOf(hours)+":"+
String.valueOf(minutes)+":"+
String.valueOf(seconds);
addObject(new Text(maxTimeString,30),750,180);
}
}
}
示例3: tutorialTileCount
import java.lang.String; //导入方法依赖的package包/类
public void tutorialTileCount(){
if(tileAText != null){
removeObject(tileAText);
}
if(tileBText != null){
removeObject(tileBText);
}
String aText = "Tile A is ";
String bText = "Tile B is ";
Tile a = allTiles[2][3];
Tile b = allTiles[7][6];
if(a.isDead){
aText+="dead and has\n";
}else{
aText+="alive and has\n";
}
if(b.isDead){
bText+="dead and has\n";
}else{
bText+="alive and has\n";
}
aText += String.valueOf(a.getNeighbours(allTiles).size());
bText += String.valueOf(b.getNeighbours(allTiles).size());
aText += " neighbours.";
bText += " neighbours.";
tileAText = new Text(aText,25+fontScale);
tileBText = new Text(bText,25+fontScale);
addObject(tileAText, 730, 510);
addObject(tileBText, 730, 565);
}