www.pudn.com > img_process_java.zip > popup.java
import java.awt.*;
import java.applet.*;
import java.awt.event.*;
// StandaloneApplet is an applet that runs either as
// an applet or a standalone application. To run
// standalone, it provides a main method that creates
// a frame, then creates an instance of the applet and
// adds it to the frame.
public class popup extends Applet implements ActionListener{
Button b1;
public void init()
{
b1 = new Button("pop up");
b1.addActionListener(this);
this.add(b1);
}
public static void main(String args[]){
Frame appletFrame = new Frame("Some applet");
Applet myApplet = new popup();
myApplet.init();
myApplet.start();
appletFrame.setLayout(new FlowLayout());
appletFrame.add(myApplet);
appletFrame.resize(300, 100);
appletFrame.setVisible(true);
}
public void actionPerformed(ActionEvent evt){
String str = evt.getActionCommand();
if(str.equals("pop up")){
Frame dummyFrame = new Frame("new");
dummyFrame.resize(300, 100);
dummyFrame.setVisible(true);
}
}
}