问答题
*/
public class ex5_6 extends JApplet{
JButton jb=new JButton("Add Text");
JTextPane jtp=new JTextPane();
public void init(){
jb.addActionListener(new ActionListener()){
public void actionPerformed(ActionEvent e){
for(int i =1;i < 10;i++)
(1) +" Welcome to China!\n";
}
};
Container cp= (2) ;
cp.add(new JScrollPane(jtp));
cp.add( (3) );
}
public static void main (String[] args){
ex5_6 obj5_6=new ex5_6();
String str=obj5_6.getClass().toString();
if(str.indexOf("class")!=-1)
str=str.Substring(6);
JFrame frm=new JFrame(str);
frm.addWindowListener(new (4) {
public void windowClosing(WindowEvent we){
System.exit(0);
}
});
(5) .add(ex5_6);
frm.setSize(300,400);
frm.setVisble(true);
}
}
ex5_6.htm|
<HTML>
<HEAD>
<TITLE>ex5_6</TITLE>
</HEAD>
<BODY>
<appletcode="ex5_6.class" Width=800 height=400>
</applet>
</BODY>
</HTML>