对不起新手问题 - 在实现 MouseListener 类(或所有其他内部类)时是否可以省略空函数签名?
所以代码会缩小几行?
JButton btnExit = new JButton("Exit");
btnExit.addMouseListener(new MouseListener() {
@Override public void mouseReleased(MouseEvent arg0) {}
@Override public void mousePressed(MouseEvent arg0) {System.exit(0);}
@Override public void mouseExited(MouseEvent arg0) {}
@Override public void mouseEntered(MouseEvent arg0) {}
@Override public void mouseClicked(MouseEvent arg0) {}
});