JLabel explainLabel=new JLabel ();
explainLabel.setText(" 说明");
explainLabel.setFont(font);
explainLabel.setBorder(BorderFactory.createLineBorder(Color.GRAY, 1));
explainLabel.addMouseListener(new MouseAdapter(){
public void MouseClicked(MouseEvent e){
explainLabel.setForeground(Color.red);
System.out.println(“鼠标已点击!”)
}
});
代码如上,为什么鼠标点击这个Label没有任何相应?
------解决思路----------------------
是mouseClicked 你写成大写的了