java语言的连连看
这段代码是什么意思,有高手能帮我看一下吗?谢了!private void jLabelMousePressed(java.awt.event.MouseEvent evt){
int x = evt.getXOnScreen();
int y = evt.getYOnScreen();
Point p = jPanel1.getLocationOnScreen();
x = x - p.x;
y = y - p.y;
x = x/55 + 1;
y = (y + 2 +1)/54 + 1;
if(!ImageArray.isNullImage(x,y)){
if(state == 0){
line = 0;
state = 1;
scrX = x;
scrY = y;
scrLabel = (JLabel)evt.getSource();
scrLabel.setBorder(new LineBorder(Color.RED));
start = getCenterPoint(scrX,scrY);
}
else if(state == 1){
state = 0;
dstX = x;
dstY = y;
dstLabel = (JLabel)evt.getSource();
dstLabel.setBorder(new LineBorder(Color.RED));
finish = getCenterPoint(dstX,dstY);
}
if(state == 0){
if(ImageArray.ifImageSame(scrX,scrY,dstX,dstY)){
if(ImageArray.ifCanOneLineConnect(scrX,scrY,dstX,dstY)){
scrLabel.setBorder(null);
dstLabel.setBorder(null);
progressBarThread.addTime(maxTime/100);
line = 1;
okTimes++;
this.paint(this.getGraphics());
if(okTimes == WIDTH * HEIGHT/2){
showPassDialog();
}
}
else if(ImageArray.ifCanTwoLinesConnect(scrX,scrY,dstX,dstY)){
scrLabel.setBorder(null);
dstLabel.setBorder(null);
progressBarThread.addTime(maxTime/100);
line = 2;
first = getCenterPoint(ImageArray.getFirstX(),ImageArray.getFirstY());
okTimes++;
this.paint(this.getGraphics());
if(okTimes == WIDTH * HEIGHT/2){
showPassDialog();
}
}
else if(ImageArray.ifCanThreeLinesConnect(scrX,scrY,dstX,dstY)){
scrLabel.setBorder(null);
dstLabel.setBorder(null);
progressBarThread.addTime(maxTime/100);
line = 3;
first = getCenterPoint(ImageArray.getFirstX(),ImageArray.getFirstY());
second = getCenterPoint(ImageArray.getSecondX(),ImageArray.getSecondY());
okTimes++;
this.paint(this.getGraphics());
if(okTimes == WIDTH * HEIGHT/2){
showPassDialog();
}
}
else{
state = 1;
scrX = dstX;
scrY = dstY;
scrLabel.setBorder(null);
scrLabel = dstLabel;
scrLabel.setBorder(new LineBorder(Color.red));
start = finish;
}
}
else{
state = 1;
scrX = dstX;
scrY = dstY;
scrLabel.setBorder(null);
scrLabel = dstLabel;
scrLabel.setBorder(new LineBorder(Color.red));
start = finish;
}
}
}
}
public Point getCenterPoint(int x,int y){
Point centerPoint = new Point();
centerPoint.x = 25 +(x-1)*55;
centerPoint.y = 50 + (y-1)*54;
centerPoint.x = centerPoint.x + jPanel1.getLocation().x;
centerPoint.y = centerPoint.y + jPanel1.getLocation().y;
return centerPoint;
} --------------------编程问答-------------------- 这个你要不要帖到Java子论坛上去啊
补充:.NET技术 , C#