以下程序片段定义由JFrame类派生的子类MyWindowDemo。类MyWindowDemo 的构造方法有五个参数:窗口的标题名,加入窗口的按钮,按钮的背景颜色,以及窗口的宽和高。 class MyWindowDemo extends JFrame { public MyWindowDemo(String name, JButton button, Color c, int w, int h){ setTitle(name); setSize(w, h); Container contentPane =_______; contentPane. _______; button.setBackground(c); } }