填空题

以下是生成菜单项对象,以及菜单项选择事件处理方法的代码。要求当菜单项singingItem被选中时,在文本框text中输出“唱歌菜单项被选中!”的字样。
............
singingItem=new______("唱歌")"//生成菜单项对象
............
public void actionPerformed(ActionEvent e)
{
if(e. getSource()==singingItem)
{
text. setText(e. ______()+"菜单项被选中!");
}
}

【参考答案】

JMenuItem
getActionCommand
热门 试题