下面ChangeTitle()中对b1和b2按钮构造监听器,实现当单击b1按钮时标题变为 students,当单击b2按钮时标题变为teachers。请将程序补充完整。
publicChangeTitle()
super(“TitleBar”);
b1.add AcdtionListener(this);
JpanelpanexneWJpanel();
Pane.add(b1);
Pane.add(b2);
SetCOntentPane(pane);
public VOidaction Performed(ActiOnEventev0
Objectsourve=evt.getSOurce();
if(SOUrve=b1)
setTitle("Students");
elSeif(source==b2)
SetTitle("TeaCherS");
repaint();