改正错误

xzjxucxx 2018-02-28 06:54:43
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package wuzi;
import java.awt.*;
/**
*
* @author Administrator
*/
public class Wuzi extends Frame{

/**
* @param args the command line arguments
*/
public static final int mm=15;
public static int n;
public int qp[][]=new int[mm][mm];
public static void main(String[] args) {
// TODO code application logic here
Wuzi myFrame=new Wuzi();
myFrame.setVisible(true);
}
public Wuzi(){
super();
final GridLayout gridLayout=new GridLayout(mm,mm);
gridLayout.setHgap(0);
gridLayout.setVgap(0);
Panel panel=new Panel();
panel.setLayout(gridLayout);
add(panel,BorderLayout.CENTER);
qz qzs[][]=new qz[mm][mm];
for(int row=0;row<mm;row++){
for(int col=0;col<mm;col++){
qzs[row][col]=new qz(row,col);
qzs[row][col].addMouseListener(new MouseListenter(){
public void mouseClicked(MouseEvent e){
qz qz1=(qz)e.getSource();

}
});
panel.add(qzs[row][col]);
}
}
}
}
class qz extends Panel{
public int i,j;
public qz(int row,int col){

}
}


请看错误在哪儿,请改正
...全文
277 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
自由自在_Yu 2018-03-01
  • 打赏
  • 举报
回复
import java.awt.*;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

public class Wuzi extends Frame {

	/**
	 * @param args
	 *            the command line arguments
	 */
	public static final int mm = 15;
	public static int n;
	public int qp[][] = new int[mm][mm];

	public static void main(String[] args) {
		// TODO code application logic here
		Wuzi myFrame = new Wuzi();
		myFrame.setVisible(true);
	}

	public Wuzi() {
		super();
		final GridLayout gridLayout = new GridLayout(mm, mm);
		gridLayout.setHgap(0);
		gridLayout.setVgap(0);
		Panel panel = new Panel();
		panel.setLayout(gridLayout);
		add(panel, BorderLayout.CENTER);
		qz qzs[][] = new qz[mm][mm];
		for (int row = 0; row < mm; row++) {
			for (int col = 0; col < mm; col++) {
				qzs[row][col] = new qz(row, col);
				qzs[row][col].addMouseListener(new MouseListener() {
					public void mouseClicked(MouseEvent e) {
						qz qz1 = (qz) e.getSource();

					}
					@Override
					public void mousePressed(MouseEvent e) {
						// TODO Auto-generated method stub
						
					}

					@Override
					public void mouseReleased(MouseEvent e) {
						// TODO Auto-generated method stub
						
					}

					@Override
					public void mouseEntered(MouseEvent e) {
						// TODO Auto-generated method stub
						
					}

					@Override
					public void mouseExited(MouseEvent e) {
						// TODO Auto-generated method stub
						
					}
				});
				panel.add(qzs[row][col]);
			}
		}
	}
}

class qz extends Panel {
	public int i, j;

	public qz(int row, int col) {

	}
}

62,628

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧