使用AWT显示HelloWorld界面

4年以前  |  阅读数:474 次  |  编程语言:JAVA 
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);
 }
}
 相关文章:
Java版本Helloworld
使用AWT显示HelloWorld界面
PHP版HelloWorld
用C++和gtkmm 2显示HelloWorld界面
使用QT显示HelloWorld
Kotlin版本的HelloWorld
C++版HelloWorld
C语言版本的HelloWorld
Python版HelloWorld
弹出HelloWorld对话框
GTK+显示HelloWorld
C#版HelloWorld
Golang版HelloWorld
VB版本的HelloWorld
C++版的HelloWorld
JavaScript版的HelloWorld
程序员的HelloWorld
Golang官方的HelloWorld
HelloWorld级的Http服务器
Golang打印传说中的 "`hello world`"