class DemoLabel extends JLabel {
    String imgpath =" ";
    int width = 0,hight = 0;
    public DemoLabel(int w, int h, String file) {
        width = w;
        hight = h;
        imgpath = file;
    }
    public void paint(Graphics g) {
        ImageIcon icon = new ImageIcon(imgpath);
        Image img = icon.getImage();
        g.drawImage(img,0,0, width,hight, null);
    }
}
------------------------------
JLabel lblT1 = new DemoLabel(150,128,"pic/1.png");
lblT1.addMouseListener(new MyMouseListener("pic/1.gif"));
------------------------------
class MyMouseListener extends MouseAdapter {
    String imgPath;
    public MyMouseListener(String a) {
        imgPath = a;
    }
    public void mousePressed(MouseEvent evt) {
       //这个位置如何获得lblT1呢,我想写 lblT1 = new DemoLabel(150,128,imgPath);想重新修改图片路径;
    }
}
哪位朋友指点下。。