[填空题] 下面ChangeTitle()中对b1和b2按钮构造监听器,实现当单击b1按钮时标题变为students,当单击b2按钮时标题变为Teachers。请将程序补充完整。
public ChangeTitle()
super("Title Bar");
b1.addAetionListener(this);
【15】
Jpanel pane = new Jpanel();
Pane.add(b1);
Pane.add(b2);
SetContentPane(pane);
public void actionPerformed(ActionEvent evt)
Object sourve = evt.getSource();
if (sourve ==b1)
setTitle("Students");
else if (source == b2)
setTitle("Teachers");
repaint();