MenuItem.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
//你的程序代码.
}
});