?? showscores.java
字號:
import javax.swing.*;
import java.io.*;
import java.awt.*;
import java.awt.event.*;
public class showScores extends JFrame{
private static final int WIDTH=100;
private static final int HEIGHT=310;
int i;String scoreNum;JLabel number1[]=new JLabel[8];Container content;jform colorShow[]=new jform[8];
//showwindow=new JFrame();
JLabel number2[]=new JLabel[8];
JLabel picture[]=new JLabel[8];
/*public void initShow()
{
int otherAll=0;
content=getContentPane();
content.setLayout(new GridLayout(8,3));
content.setBackground(Color.gray);
//showwindow.setBackground(new Color(0,0,0));
//showwindow.setLayout();
for(i=0;i<7;i++)
{
setSize (WIDTH,HEIGHT);
colorShow[i]=new jform();
colorShow[i].setcon(i);
content.add(colorShow[i].con);
scoreNum=""+colorAll[i];
otherAll+=colorAll[i];
number1[i]=new JLabel(scoreNum);
content.add(number1[i]);
scoreNum="del"+colorCleared[i];
number2[i]=new JLabel(scoreNum);
content.add(number2[i]);
}
colorShow[i]=new jform();
colorShow[i].setcon(i);
content.add(colorShow[i].con);
scoreNum=""+(81-otherAll);
number1[i]=new JLabel(scoreNum);
content.add(number1[i]);
//scoreNum="del"+centerjpanel.colorCleared[i];
//number=new JLabel(scoreNum);
//content.add(number1[i]);
}*/
public showScores(int colorAll[],int colorCleared[])
{
int i=0,otherAll=0;
setSize (WIDTH,HEIGHT);
setResizable(false);
content=getContentPane();
content.setLayout(new GridLayout(8,3));
content.setBackground(Color.gray);
for(;i<7;i++)
{
picture[i]=new JLabel();
deal(i,i);
content.add(picture[i]);
otherAll+=colorAll[i];
scoreNum=""+colorAll[i];
number1[i]=new JLabel(scoreNum);
content.add(number1[i]);
scoreNum="del"+colorCleared[i];
number2[i]=new JLabel(scoreNum);
content.add(number2[i]);
}
picture[i]=new JLabel();
deal(i,i);
content.add(picture[i]);
scoreNum=""+(81-otherAll);
number1[i]=new JLabel(scoreNum);
content.add(number1[i]);
setDefaultCloseOperation(HIDE_ON_CLOSE);
}
public void alter(int colorAll[],int colorCleared[])
{
int i=0,otherAll=0;
for(;i<7;i++)
{
otherAll+=colorAll[i];
scoreNum=""+colorAll[i];
number1[i].setText(scoreNum);
scoreNum="del"+colorCleared[i];
number2[i].setText(scoreNum);
}
scoreNum=""+(81-otherAll);
number1[i].setText(scoreNum);
}
public void showKey(boolean key)
{
setVisible(key);
}
void deal(int i,int color)//
{
switch(color)
{
case 0:
picture[i].setIcon(new ImageIcon("1.gif"));
break;
case 1:
picture[i].setIcon(new ImageIcon("2.gif"));
break;
case 2:
picture[i].setIcon(new ImageIcon("3.gif"));
break;
case 3:
picture[i].setIcon(new ImageIcon("4.gif"));
break;
case 4:
picture[i].setIcon(new ImageIcon("5.gif"));
break;
case 5:
picture[i].setIcon(new ImageIcon("6.gif"));
break;
case 6:
picture[i].setIcon(new ImageIcon("7.gif"));
break;
default :
picture[i].setIcon(new ImageIcon("blank.gif"));
break;
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -