import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class HelloFrame extends JFrame {
JPanel contentPane ;
BorderLayout borderLayout1 =new BorderLayout ();
JLabel jLabel1 = new JLabel () ;
public HelloFrame ()
{
try {
jbInit();
}
catch (Exception e)
{
e.printStackTrace();
}
}
private void jbInit() throws Exception
{
contentPane =(JPanel) this.getContentPane();
contentPane.setLayout(borderLayout1);
this.setSize(400, 300);
this.setTitle("Hello");
jLabel1.setFont(new java.awt.Font("Dialog",1,25));
jLabel1.setText(Hello,java);
contentPane.add(jLabel,BorderLayout.CENTER);
}
protected void processWindowEvent(WindowEvent e)
{
if (e.getID()==WindowEvent.WINDOW_CLOSING){
System.exit(0);
}
}
}
能解释下程序中this的用法吗?谢谢哦
[此贴子已经被作者于2007-8-19 12:36:51编辑过]