j**a的源代码

时间:2014.05.04 发布人:summer灬辉辉

j**a的源代码

已解决问题

谷歌summer灬辉辉用户在2014.05.04提交了关于“村上春树j**a的源代码”的提问,欢迎大家涌跃发表自己的观点。目前共有7个回答,最后更新于2024-12-13T12:04:44。希望大家能够帮助她。

详细问题描述及疑问:期待您的答案,我不知道说什么才好,除了谢谢 !

希望以下的回答,能够帮助你。

第1个回答

用户名:懿童2013  

来自连连看j**a源代问答码
importj**ax.sw却神己众振叶ing.*;
importj**a.awt.*;
importj**a.awt.event.*;
publicclasslianliankanimple官群是政级mentsActionListener
{
JFramemainFrame;//主面板
ContainerthisContainer;
JPanelcenterP美获差决农连请意厚多anel,southPanel,northPanel;//子面板
JButtondiamondsButton[][]=newJButton[6][5];//游戏按钮数组
JButtonexitButton,resetButton,newlyButton;//退出,重列,重新必测与滑威古坚晶音凯开始按钮
JLab语看服劳流维现镇谓死盟elfractionLable=newJLabel("0");//分数标签
JButtonfirstButton,secondButton;//分别记录两次被选中的按钮
intgrid[][]=newint[8][7];//储存游戏按钮位置
staticbooleanpressInformation=false;//判断是否有按钮被选中
intx0=0,y0=0,x=0,y=0,fristMsg=0,se至刘落许老condMsg=0,validateLV;//游戏按钮的位置坐标
inti,j,k,n;//消除方法控制
publicvoidinit(){
mainFrame=newJFrame("JKJ连连看");
thisContainer=mainFrame.getContentPane();
thisContainer.setLayout(newBorderLayout());
centerPanel=newJPanel();
southPanel=n送永吧联财盐银见论合花ewJPanel();
northPanel=newJPanel();
thisContainer.add(centerPanel,"Center");
thi井便言不sContainer.add(southPanel,"South");
thisContainer.add(northPanel,"North");
centerPanel.setL元翻味新营价背ayout(ne煤开组席上两却防作杂wGridLayout(6,5));
for(intcols=0;cols<6;cols++){
for(introws=0;rows<5;rows++){
diamondsButton[cols][rows]=newJButton(String.valueOf(grid[cols+1][ro象星吃红ws+1]));
diamondsButton[cols][rows].a茬ddActionListener(th仅节受is);
centerPanel.add(diamondsButton[cols][rows]);
}
}
exitButton=newJButton("退出");
exitButton.addActionListener(this);
resetButton=newJButton("重列");
re定剂文又未宗失setButton.addActionListener(this);
newlyButton=newJButton("再来一局");
newlyButton.addActionListener(this);
so宁药序凯uthPanel.add(exitButton);
southPanel.add(resetButt愿香限办伤充夫on);
southPanel.add(newlyButton);
fractionLabl草待意逐握画载毛征亮e.setText(String.valueOf(Integer.parseInt(fractionLable.getText())));
northPanel.a太制末统dd(fractionLable);
mainFrame.setBounds(280,100,500,450);
mainFrame.setVisible(true);
}
publicvoidrandomBuild(){
intrandoms,cols,rows;
for(inttwins=1;twins<=15;twins++){
randoms=(int)(Math.random()*25+1);
for(intalike=1;alike<=2;alike++){
cols=(int)(Math.random()*6+1);
rows=(int)(Math.random()*5+1);
while(grid[cols][rows]!=0){
cols=(int)(Math.random()*6+1);
rows=(int)(Math.random()*5+1);
}
this.grid[cols][rows]=randoms;
}
}
}
publicvoidfraction(){
fractionLable.setText(String.valueOf(Integer.parseInt(fractionLable.getText())+100));
}
publicvoidreload(){
ints**e[]=newint[30];
intn=0,cols,rows;
intgrid[][]=newint[8][7];
for(inti=0;i<=6;i++){
for(intj=0;j<=5;j++){
if(this.grid[i][j]!=0){
s**e[n]=this.grid[i][j];
n++;
}
}
}
n=n-1;
this.grid=grid;
while(n>=0){
cols=(int)(Math.random()*6+1);
rows=(int)(Math.random()*5+1);
while(grid[cols][rows]!=0){
cols=(int)(Math.random()*6+1);
rows=(int)(Math.random()*5+1);
}
this.grid[cols][rows]=s**e[n];
n--;
}
mainFrame.setVisible(false);
pressInformation=false;//这里一定要将按钮点击信息归为初始
init();
for(inti=0;i<6;i++){
for(intj=0;j<5;j++){
if(grid[i+1][j+1]==0)
diamondsButton[i][j].setVisible(false);
}
}
}
publicvoidestimateEven(intplaceX,intplaceY,JButtonbz){
if(pressInformation==false){
x=placeX;
y=placeY;
secondMsg=grid[x][y];
secondButton=bz;
pressInformation=true;
}
else{
x0=x;
y0=y;
fristMsg=secondMsg;
firstButton=secondButton;
x=placeX;
y=placeY;
secondMsg=grid[x][y];
secondButton=bz;
if(fristMsg==secondMsg&&secondButton!=firstButton){
xiao();
}
}
}
publicvoidxiao(){//相同的情况下能不能消去。仔细分析,不一条条注释
if((x0==x&&(y0==y+1||y0==y-1))||((x0==x+1||x0==x-1)&&(y0==y))){//判断是否相邻
remove();
}
else{
for(j=0;j<7;j++){
if(grid[x0][j]==0){//判断第一个按钮同行哪个按钮为空
if(y>j){//如果第二个按钮的Y坐标大于空按钮的Y坐标说明第一按钮在第二按钮左边
for(i=y-1;i>=j;i--){//判断第二按钮左侧直到第一按钮中间有没有按钮
if(grid[x][i]!=0){
k=0;
bre**;
}
else{k=1;}//K=1说明通过了第一次验
}
if(k==1){
linePassOne();
}
}
if(y<j){//如果第二个按钮的Y坐标小于空按钮的Y坐标说明第一按钮在第二按钮右边
for(i=y+1;i<=j;i++){//判断第二按钮左侧直到第一按钮中间有没有按钮
if(grid[x][i]!=0){
k=0;
bre**;
}
else{k=1;}
}
if(k==1){
linePassOne();
}
}
if(y==j){
linePassOne();
}
}
if(k==2){
if(x0==x){
remove();
}
if(x0<x){
for(n=x0;n<=x-1;n++){
if(grid[n][j]!=0){
k=0;
bre**;
}
if(grid[n][j]==0&&n==x-1){
remove();
}
}
}
if(x0>x){
for(n=x0;n>=x+1;n--){
if(grid[n][j]!=0){
k=0;
bre**;
}
if(grid[n][j]==0&&n==x+1){
remove();
}
}
}
}
}
for(i=0;i<8;i++){//列
if(grid[i][y0]==0){
if(x>i){
for(j=x-1;j>=i;j--){
if(grid[j][y]!=0){
k=0;
bre**;
}
else{k=1;}
}
if(k==1){
rowPassOne();
}
}
if(x<i){
for(j=x+1;j<=i;j++){
if(grid[j][y]!=0){
k=0;
bre**;
}
else{k=1;}
}
if(k==1){
rowPassOne();
}
}
if(x==i){
rowPassOne();
}
}
if(k==2){
if(y0==y){
remove();
}
if(y0<y){
for(n=y0;n<=y-1;n++){
if(grid[i][n]!=0){
k=0;
bre**;
}
if(grid[i][n]==0&&n==y-1){
remove();
}
}
}
if(y0>y){
for(n=y0;n>=y+1;n--){
if(grid[i][n]!=0){
k=0;
bre**;
}
if(grid[i][n]==0&&n==y+1){
remove();
}
}
}
}
}
}
}
publicvoidlinePassOne(){
if(y0>j){//第一按钮同行空按钮在左边
for(i=y0-1;i>=j;i--){//判断第一按钮同左侧空按钮之间有没按钮
if(grid[x0][i]!=0){
k=0;
bre**;
}
else{k=2;}//K=2说明通过了第二次验
}
}
if(y0<j){//第一按钮同行空按钮在与第二按钮之间
for(i=y0+1;i<=j;i++){
if(grid[x0][i]!=0){
k=0;
bre**;
}
else{k=2;}
}
}
}
publicvoidrowPassOne(){
if(x0>i){
for(j=x0-1;j>=i;j--){
if(grid[j][y0]!=0){
k=0;
bre**;
}
else{k=2;}
}
}
if(x0<i){
for(j=x0+1;j<=i;j++){
if(grid[j][y0]!=0){
k=0;
bre**;
}
else{k=2;}
}
}
}
publicvoidremove(){
firstButton.setVisible(false);
secondButton.setVisible(false);
fraction();
pressInformation=false;
k=0;
grid[x0][y0]=0;
grid[x][y]=0;
}
publicvoidactionPerformed(ActionEvente){
if(e.getSource()==newlyButton){
intgrid[][]=newint[8][7];
this.grid=grid;
randomBuild();
mainFrame.setVisible(false);
pressInformation=false;
init();
}
if(e.getSource()==exitButton)
System.exit(0);
if(e.getSource()==resetButton)
reload();
for(intcols=0;cols<6;cols++){
for(introws=0;rows<5;rows++){
if(e.getSource()==diamondsButton[cols][rows])
estimateEven(cols+1,rows+1,diamondsButton[cols][rows]);
}
}
}
publicstaticvoidmain(String[]args){
lianliankanllk=newlianliankan();
llk.randomBuild();
llk.init();
}
}

第2个回答

用户名:火鸡的生活  

你去j**a网站下载jdk就行本身就是开源的可以直接查看的

第3个回答

用户名:城乡结合部来的  

j**a的源代码,一般在jdk安装的时候就安装到了jdk目录下的src目录中了

第4个回答

用户名:Aceh**onor  

是不是openjdk??

第5个回答

用户名:叶清  

s什么源码?

第6个回答

用户名:TinyZ_华  

J**a的源代码?

问的是JDK源代码?

还是说J**a写的小程序源码?请提问者描述清楚

第7个回答

用户名:清风满路  

自己的应用还是jdk的源代码?