java layout.setVgap_java代码求高手注释啊?看不懂!

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

} else {

k = 2;

}

}

}

if (x0 < i) {

for (j = x0 + 1; j <= i; j++) {

if (grid[j][y0] != 0) {

k = 0;

break;

} else {

k = 2;

}

}

}

} public Boolean remove(Boolean typeFlag) {

Boolean successFlag=false;

if(typeFlag){

firstButton.setVisible(false);

secondButton.setVisible(false);

fraction();

pressInformation = false;

k = 0;

grid[x0][y0] = 0;

grid[x][y] = 0;

}

else

{

firstButton.setBackground(Color.red);

secondButton.setBackground(Color.red);

successFlag=true;

}

return successFlag;

} public void actionPerformed(ActionEvent e) {

if (e.getSource().equals(newlyButton)) {

String level = llk.globeGameLevel;

changeGameLevel(level);

}

if (e.getSource().equals(exitButton))

System.exit(0);

if (e.getSource().equals(resetButton)) {

reLoadFlag = true;

reload();

} if (e.getSource().equals(changeButton)) {

if ("img2/".equals(cardPackage)) {

cardPackage = "img/";// 图片的目录

cardType = ".jpg";// 图片的格式

} else {

cardPackage = "img2/";// 图片的目录

cardType = ".gif";// 图片的格式

} reLoadFlag = true;

reload();

}

if (e.getSource().equals(helpButton)) {

Boolean successFlag = false;

for (int i = 0; i < globeCols; i++) {

for (int j = 0; j < globeRows; j++) {

if (grid[i + 1][j + 1] != 0 && diamondsButton[i][j].isVisible() ) {

e.setSource(diamondsButton[i][j]);

for (int cols = 0; cols < globeCols; cols++) {

for (int rows = 0; rows < globeRows; rows++) {

if (diamondsButton[cols][rows].isVisible()&&e.getSource() == diamondsButton[cols][rows]&& grid[cols + 1][rows + 1] != 0) {

successFlag = estimateEven(cols + 1,

rows + 1,

diamondsButton[cols][rows], false);

if (successFlag) {

break;

}

}

}

if (successFlag) {

break;

}

}

}

if (successFlag) {

break;

}

} if (successFlag) {

break;

}

}

} if (e.getSource().equals(resetButton)) {

reLoadFlag = true; reload();

}

// 判断游戏的级别

if (e.getSource().equals(easyButton)) {

changeGameLevel("easy");

}

if (e.getSource().equals(midButton)) {

changeGameLevel("mid");

}

if (e.getSource().equals(hardButton)) {

changeGameLevel("hard");

}

for (int cols = 0; cols < globeCols; cols++) {

for (int rows = 0; rows < globeRows; rows++) {

if (e.getSource() == diamondsButton[cols][rows])

estimateEven(cols + 1, rows + 1, diamondsButton[cols][rows],true);

}

}

}

/**

* 初始化游戏级别

* @param cols 列数

* @param rows 行数

* @param pictNum 图片数

* @param maxGameTime 最大用时

*/

private void initGameLevel(int cols,int rows, int pictNum,int maxGameTime)

{

globeCols = cols;

globeRows = rows;

diamondsButton = new JButton[globeCols][globeRows];

grid = new int[globeCols + 2][globeRows + 2];

pictCount = pictNum;

maxTime = maxGameTime;

fractionLable = new JLabel("0");

randomBuild();

}

/**

* 改变游戏级别

*/

private void changeGameLevel(String gameLevel)

{

st.stopthread();

changeButton.setEnabled(true);

resetButton.setEnabled(true);

helpButton.setEnabled(true);

llk = new lianliankan();

mainFrame.setVisible(false);

pressInformation = false; // 这里一定要将按钮点击信息归为初始

// 默认游戏的级别为简单

llk.init(gameLevel);

st = new MainClass(llk);

st.start();

}

public static void main(String[] args) { llk.init("easy"); st.start();

}

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值