[填空题] 下面ChangeTitle()中对b1和b2按键构造监听器,实现当按下b1键时标题变为Students,当按下b2键时标题变为Teachers。添加空缺的语句。 ... public C
18 查阅
[填空题] 下面ChangeTitle()中对b1和b2按键构造监听器,实现当按下b1键时标题变为Students,当按下b2键时标题变为Teachers。添加空缺的语句。 ... public ChangeTitle() { super("Title Bar"); b1.addActionListener(this); 【11】 ; Jpanel pane = new Jpane1(); 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(); } ...
参考答案: