您的位置:寻梦网首页编程乐园Java天地Core JavaJava Lecture Notes

previous.gif
 (3087 bytes)

next.gif
 (2959 bytes)


Content Index

Content Page # 22

Example applet creating a frame

The following applet will create a separate, frame window, apart from the applet window:

import java.applet.Applet;

import java.awt.*;

public class Frame1 extends Applet

{

public Frame1()

{

  Frame myFrame = new Frame("A frame created by an applet");

  myFrame.setSize( 300, 200 );

  myFrame.show();

}

} // class

As with the menu frame example, since no code has been written to deal with actions, you cannot close this frame window. However, when you close the applet window, the frame object will be destroyed and its window removed.

Back to top

basicline.gif (170 bytes)