JAVA
·
发表于 5年以前
·
阅读量:898
import java.awt.*;
import java.awt.event.*;
public class HelloFrame extends Frame
{
HelloFrame(String title)
{
super(title);
}
public void paint(Graphics g)
{
super.paint(g);
java.awt.Insets ins = this.getInsets();
g.drawString("Hello, World!", ins.left + 25, ins.top + 25);
}
public static void main(String args [])
{
HelloFrame fr = new HelloFrame("Hello");
fr.addWindowListener(
new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit( 0 );
}
}
);
fr.setResizable(true);
fr.setSize(500, 100);
fr.setVisible(true);
}
}