public void setColor(Label l,int value)
{
l.setText(value+"");
l.setFont(new java.awt.Font("Arial", 1, 60));
if(value==0)
{
l.setText("");
l.setBackground(Color.white);
}
else if(value==2)
l.setBackground(Color.yellow);
else if(value==4)
l.setBackground(Color.orange);
else if(value==8)
l.setBackground(Color.cyan);
else if(value==16)
l.setBackground(Color.green);
else if(value==32)
l.setBackground(Color.pink);
else if(value==64)
l.setBackground(Color.red);
else if(value==128)
l.setBackground(Color.blue);
else if(value==256)
l.setBackground(Color.magenta);
else if(value==512)
l.setBackground(Color.lightGray);
else if(value==1024)
l.setBackground(Color.darkGray);
else if(value==2048)
l.setBackground(Color.black);
if(value>64)
l.setFont(new java.awt.Font("Arial", 1, 45));
if(value>512)
l.setFont(new java.awt.Font("Arial", 1, 30));
}
Sample2048GUI.java 文件源码
java
阅读 28
收藏 0
点赞 0
评论 0
项目:2048-Game-PC
作者:
评论列表
文章目录