中国象棋微信隐藏代码

中国象棋微信隐藏代码,第1张

中国象棋微信隐藏代码是114514。

Android与IOS最不一样的地方,莫过于一个标签栏在下一个标签栏在上了。实话棚备说,Android版微信的界面设计并不出彩,而且相当没有Android味!“//switchtabpos”这段代码的最大用处,就是将Tab栏由之前的下方挪至上方,于是原本还透着浓浓IOS味的UI瞬间就有了Android范。启和旦最关键的是,这还是一条开关码,什么时候用腻了,悄扰再输入一遍,立马就能还原回之前的样子。

这个程序实现还要一个关联文件夹“image”象棋棋子图片 部分代码如下:(代码太长 给个邮箱 我发给你)

import java.awt.*

import java.awt.event.*

import javax.swing.*

import java.util.*

import java.io.*

//主类

public class Chess{

public static void main(String args[]){

new ChessMainFrame("中国象棋:观棋不语真君子,棋死无悔大丈夫")

}

}

//主框架类

class ChessMainFrame extends JFrame implements ActionListener,MouseListener,Runnable{

//玩家

JLabel play[] = new JLabel[32]

//棋盘

JLabel image

//窗格

Container con

//工具栏

JToolBar jmain

//重新开始

JButton anew

//悔棋

JButton repent

//退出

JButton exit

//当前信息

JLabel text

//保存当前 *** 作

Vector Var

//规则类对象(使于调用方法)

ChessRule rule

/**

** 单击棋子

** chessManClick = true 闪烁棋子 并给线程响应

** chessManClick = false 吃棋子 停止闪烁 并给线程响应

*/

boolean chessManClick

/**

** 控制玩家走棋

** chessPlayClick=1 黑棋走棋

** chessPlayClick=2 红棋走棋 默认红棋

** chessPlayClick=3 双方都不能走棋

*/

int chessPlayClick=2

//控制棋兆银竖子闪烁的线程

Thread tmain

//把第一次的单击棋子给线程响应

static int Man,i

ChessMainFrame(){

new ChessMainFrame("中国象棋")

}

/**

** 构造函数

** 初始化图形用户界面

*/

ChessMainFrame(String Title){

//获行客格引用搏租

con = this.getContentPane()

con.setLayout(null)

//实例化规则类

rule = new ChessRule()

Var = new Vector()

//创建工具栏

jmain = new JToolBar()

text = new JLabel("欢迎使用象棋对弈系统")

//当鼠标放上显示信息

text.setToolTipText("信息提示")

anew = new JButton(" 新 游 戏 ")

anew.setToolTipText("重新开始新的一局")

exit = new JButton(" 退 出 ")

exit.setToolTipText("退出象棋程序程序"族大)

repent = new JButton(" 悔 棋 ")

repent.setToolTipText("返回到上次走棋的位置")

//把组件添加到工具栏

jmain.setLayout(new GridLayout(0,4))

jmain.add(anew)

jmain.add(repent)

jmain.add(exit)

jmain.add(text)

jmain.setBounds(0,0,558,30)

con.add(jmain)

//添加棋子标签

drawChessMan()

//注册按扭监听

anew.addActionListener(this)

repent.addActionListener(this)

exit.addActionListener(this)

//注册棋子移动监听

for (int i=0i<32i++){

con.add(play[i])

play[i].addMouseListener(this)

}

//添加棋盘标签

con.add(image = new JLabel(new ImageIcon("image\\Main.GIF")))

image.setBounds(0,30,558,620)

image.addMouseListener(this)

//注册窗体关闭监听

this.addWindowListener(

new WindowAdapter() {

public void windowClosing(WindowEvent we){

System.exit(0)

}

}

)

//窗体居中

Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize()

Dimension frameSize = this.getSize()

if (frameSize.height >screenSize.height){

frameSize.height = screenSize.height

}

if (frameSize.width >screenSize.width){

frameSize.width = screenSize.width

}

this.setLocation((screenSize.width - frameSize.width) / 2 - 280 ,(screenSize.height - frameSize.height ) / 2 - 350)

//设置

this.setIconImage(new ImageIcon("image\\红将.GIF").getImage())

this.setResizable(false)

this.setTitle(Title)

this.setSize(558,670)

this.show()

}

/**

** 添加棋子方法

*/

public void drawChessMan(){

//流程控制

int i,k

//图标

Icon in

//黑色棋子

//车

in = new ImageIcon("image\\黑车.GIF")

for (i=0,k=24i<2i++,k+=456){

play[i] = new JLabel(in)

play[i].setBounds(k,56,55,55)

play[i].setName("车1")

}

//马

in = new ImageIcon("image\\黑马.GIF")

for (i=4,k=81i<6i++,k+=342){

play[i] = new JLabel(in)

play[i].setBounds(k,56,55,55)

play[i].setName("马1")

}

//相

in = new ImageIcon("image\\黑象.GIF")

for (i=8,k=138i<10i++,k+=228){

play[i] = new JLabel(in)

play[i].setBounds(k,56,55,55)

play[i].setName("象1")

}

//士

in = new ImageIcon("image\\黑士.GIF")

for (i=12,k=195i<14i++,k+=114){

play[i] = new JLabel(in)

play[i].setBounds(k,56,55,55)

play[i].setName("士1")

}

//卒

in = new ImageIcon("image\\黑卒.GIF")

for (i=16,k=24i<21i++,k+=114){

play[i] = new JLabel(in)

play[i].setBounds(k,227,55,55)

play[i].setName("卒1" + i)

}

//炮

in = new ImageIcon("image\\黑炮.GIF")

for (i=26,k=81i<28i++,k+=342){

play[i] = new JLabel(in)

play[i].setBounds(k,170,55,55)

play[i].setName("炮1" + i)

}

//将

in = new ImageIcon("image\\黑将.GIF")

play[30] = new JLabel(in)

play[30].setBounds(252,56,55,55)

play[30].setName("将1")

//红色棋子

//车

in = new ImageIcon("image\\红车.GIF")

for (i=2,k=24i<4i++,k+=456){

play[i] = new JLabel(in)

play[i].setBounds(k,569,55,55)

play[i].setName("车2")

}

//马

in = new ImageIcon("image\\红马.GIF")

for (i=6,k=81i<8i++,k+=342){

play[i] = new JLabel(in)

play[i].setBounds(k,569,55,55)

play[i].setName("马2")

}

//相

in = new ImageIcon("image\\红象.GIF")

for (i=10,k=138i<12i++,k+=228){

play[i] = new JLabel(in)

play[i].setBounds(k,569,55,55)

play[i].setName("象2")

}

//士

in = new ImageIcon("image\\红士.GIF")

for (i=14,k=195i<16i++,k+=114){

play[i] = new JLabel(in)

play[i].setBounds(k,569,55,55)

play[i].setName("士2")

}

//兵

in = new ImageIcon("image\\红卒.GIF")

for (i=21,k=24i<26i++,k+=114){

play[i] = new JLabel(in)

play[i].setBounds(k,398,55,55)

play[i].setName("卒2" + i)

}

//炮

in = new ImageIcon("image\\红炮.GIF")

for (i=28,k=81i<30i++,k+=342){

play[i] = new JLabel(in)

play[i].setBounds(k,455,55,55)

play[i].setName("炮2" + i)

}

//帅

in = new ImageIcon("image\\红将.GIF")

play[31] = new JLabel(in)

play[31].setBounds(252,569,55,55)

play[31].setName("帅2")

}

/**

** 线程方法控制棋子闪烁

*/

}

中国象棋源代码blackleft(){ int x,y,n if(blackcurpos.y>0) {blackcurpos.y--x=position[blacktemppos.x][blacktemppos.y].x y=position[blacktemppos.x][blacktemppos.y].y if(board[blacktemppos.x][blacktemppos.y]==0)drawbmp(x,y,boardfile[blacktemppos.x][blacktemppos.y]) else if(!(blacktemppos.x==blackoldpos.x&&blacktemppos.y==blackoldpos.y&&blackstate==MOVE)) {n=board[blacktemppos.x][blacktemppos.y] drawbmp(x,y,chessfile[n]) } if(blacktemppos.x==blackoldpos.x&&blacktemppos.y==blackoldpos.y&&blackstate==MOVE)drawselecursor(blackoldpos) drawcursor(blackcurpos) blacktemppos.x=blackcurpos.x blacktemppos.y=blackcurpos.y }}blackright(){ int x,y,n if(blackcurpos.y<8) {blackcurpos.y++x=position[blacktemppos.x][blacktemppos.y].x y=position[blacktemppos.x][blacktemppos.y].y if(board[blacktemppos.x][blacktemppos.y]==0)drawbmp(x,y,boardfile[blacktemppos.x][blacktemppos.y]) else if(!(blacktemppos.x==blackoldpos.x&&blacktemppos.y==blackoldpos.y&&blackstate==MOVE)) {n=board[blacktemppos.x][blacktemppos.y] drawbmp(x,y,chessfile[n]) } if(blacktemppos.x==blackoldpos.x&&blacktemppos.y==blackoldpos.y&&blackstate==MOVE)drawselecursor(blackoldpos) drawcursor(blackcurpos) blacktemppos.x=blackcurpos.x blacktemppos.y=blackcurpos.y }}blackdo(){ int i,j,x,y,n if(blackstate==SELECT&&blackcanselect()) {if(board[blackcurpos.x][blackcurpos.y]<=BLACK&&board[blackcurpos.x][blackcurpos.y]>0){ blackstate=MOVE drawselecursor(blackcurpos) blackoldpos.x=blackcurpos.x blackoldpos.y=blackcurpos.y } } else if(blackstate==MOVE&&blackcanmove()) {x=position[blackoldpos.x][blackoldpos.y].x y=position[blackoldpos.x][blackoldpos.y].y drawbmp(x,y,boardfile[blackoldpos.x][blackoldpos.y]) x=position[blackcurpos.x][blackcurpos.y].x y=position[blackcurpos.x][blackcurpos.y].y n=board[blackoldpos.x][blackoldpos.y] drawbmp(x,y,chessfile[n]) if(board[blackcurpos.x][blackcurpos.y]==RED_JIANG){ winner=BLACK finish=1 return }board[blackcurpos.x][blackcurpos.y]=n board[blackoldpos.x][blackoldpos.y]=0 for(i=0i<=2i++) for(j=3j<=5j++)if(board[i][j]==BLACK_JIANG) {x=iy=j}for(i=x+1,j=y,n=0i<=9i++){ if(board[i][j]==RED_JIANG&&n==0) {winner=REDfinish=1break} else if(board[i][j]!=0) n++ } turn=RED redstate=SELECT drawcursor(redcurpos) drawbmp(30,438,"bmp\\rzq.wfb") /*转交控制权给红方*/ } }blackundo(){ int x,y,n if(blackstate==MOVE) {x=position[blackoldpos.x][blackoldpos.y].x y=position[blackoldpos.x][blackoldpos.y].y n=board[blackoldpos.x][blackoldpos.y] drawbmp(x,y,chessfile[n]) blackoldpos.x=blackcurpos.x blackoldpos.y=blackcurpos.y drawcursor(blackcurpos) blackstate=SELECT }}/*----------------------------------------------------*/start(){ drawcursor(blackcurpos) drawbmp(30,438,"bmp\\bzq.wfb") while(!finish) {key=getkey() switch(key){ case RED_UP: if(turn==RED) redup() break case RED_DOWN: if(turn==RED) reddown() break case RED_LEFT: if(turn==RED) redleft() break case RED_RIGHT: if(turn==RED) redright() break case RED_DO: if(turn==RED) reddo() break case RED_UNDO: if(turn==RED) redundo() breakcase BLACK_UP: if(turn==BLACK) blackup() break case BLACK_DOWN: if(turn==BLACK) blackdown() break case BLACK_LEFT: if(turn==BLACK) blackleft() break case BLACK_RIGHT: if(turn==BLACK) blackright() break case BLACK_DO:if(turn==BLACK) blackdo() break case BLACK_UNDO:if(turn==BLACK) blackundo() break case ESCAPE: finish=1break } }}main(){ init() initpos() initchessmap() drawbmp(0,0,"bmp\\board.wfb") initdrawchess() /*初始化光标位置*/ redcurpos.x=redoldpos.x=redtemppos.x=9 redcurpos.y=redoldpos.y=redtemppos.y=8 blackcurpos.x=blackoldpos.x=blacktemppos.x=0 blackcurpos.y=blackoldpos.y=blacktemppos.y=0/*开始*/ start() if(winner==RED)drawbmp(200,200,"bmp\\redwin.wfb") else if(winner==BLACK)drawbmp(200,200,"bmp\\blackwin.wfb") elsedrawbmp(200,200,"bmp\\exit.wfb") getch() end()}


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/12509469.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-26
下一篇 2023-05-26

发表评论

登录后才能评论

评论列表(0条)

保存