91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 263KB
    文件類型: .zip
    金幣: 2
    下載: 0 次
    發(fā)布日期: 2021-06-06
  • 語言: 其他
  • 標(biāo)簽: tiatactoe??

資源簡介

適用于初學(xué)者,文件是編寫的井字棋小程序,內(nèi)有源碼。

資源截圖

代碼片段和文件信息

package?tiatactoe;

import?javax.swing.*;
import?java.awt.*;
import?java.awt.event.*;

public?class?Gui_TTT?extends?Jframe{
private?JLabel?labtitle;
private?JButton[][]?btncell=new?JButton[3][3];
private?JButton?btnNewbtnBack;
private?JDialog?dialog;
private static?int?index=0;
/*private?ImageIcon?bb=new?ImageIcon(“src/tiatactoe/blackboard.png“);
private?ImageIcon?wall=new?ImageIcon(“src/tiatactoe/wall.png“);
private?JLabel?label1=new?JLabel()label2=new?JLabel();*/

public?Gui_TTT()?{
super(“TicTacToe“);
JPanel?panel=(JPanel)getContentPane();
panel.setOpaque(false);
setSize(300500);
setVisible(true);
panel.setLayout(null);
Font?font=new?Font(“宋體“Font.BOLD24);

labtitle=new?JLabel(“TicTacToe“);
labtitle.setFont(font);
labtitle.setForeground(Color.MAGENTA);
labtitle.setBounds(75?0?150?60);
panel.add(labtitle);

btnNew=new?JButton(“new“);
btnNew.setFont(new?Font(“宋體“Font.PLAIN10));
btnNew.setBounds(225?50?50?30);
btnNew.setFocusPainted(false);
btnNew.setContentAreaFilled(false);
btnBack=new?JButton(“back“);
btnBack.setFont(new?Font(“宋體“Font.PLAIN8));
btnBack.setBounds(25505030);
btnBack.setFocusPainted(false);
btnBack.setContentAreaFilled(false);
panel.add(btnBack);
panel.add(btnNew);

ActionListener?cellClick=new?ActionListener()?{
public?void?actionPerformed(ActionEvent?e)?{
index++;
if(index%2==1)?{
JButton?btn=(JButton)e.getSource();
if(btn.getText()!=“√“&&btn.getText()!=“ד)?{
btn.setFont(new?Font(“宋體“Font.BOLD48));
btn.setForeground(Color.white);
btn.setText(“√“);
if(isOver())?{
dialog=new?JDialog();
dialog.setVisible(true);
dialog.setBounds(0?0?100?100);
dialog.add(new?JLabel(“The?player1?wins!“));
}
else?System.out.println(“Go?on!“);
}
else?{
System.out.println(“Here‘s?ocuppied.“);
index--;
}

}
else?{
JButton?btn=(JButton)e.getSource();
if(btn.getText()!=“√“&&btn.getText()!=“ד)?{
btn.setFont(new?Font(“宋體“Font.BOLD48));
btn.setForeground(Color.white);
btn.setText(“ד);
if(isOver())?{
dialog=new?JDialog();
dialog.setVisible(true);
dialog.setBounds(0?0?100?100);
dialog.add(new?JLabel(“The?player2?wins!“));
}
else?System.out.println(“Go?on!“);
}
else?{
System.out.println(“Here‘s?ocuppied.“);
index--;
}
}
}
};
for(int?i=0;i<3;i++)?{
for(int?j=0;j<3;j++)?{
btncell[i][j]=new?JButton();
panel.add(btncell[i][j]);
btncell[i][j].setBounds(10+90*i?100+90*j?85?85);
btncell[i][j].addActionListener(cellClick);
btncell[i][j].setFocusPainted(false);
btncell[i][j].setContentAreaFilled(false);
}
}

ActionListener?newClick=new?ActionListener()?{
public?void?actionPerformed(ActionEvent?e)?{

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2017-12-10?15:39??tiatactoe\
?????文件???????12794??2017-12-10?15:09??tiatactoe\blackboard.png
?????文件????????4705??2017-12-10?16:16??tiatactoe\Gui_TTT.java
?????文件??????254566??2017-12-10?15:29??tiatactoe\wall.png

評論

共有 條評論

相關(guān)資源