import java.awt.*;
import java.awt.event.*;
import java.applet.*;
class SampleFrame extends Frame
{
SampleFrame(String title)
{
super(title);
MyWindowAdapter adapter = new MyWindowAdapter(this);
addWindowListener(adapter);
}
public void paint(Graphics g)
{
g.drawString("This in frame Window",10,40);
}
}
class MyWindowAdapter extends WindowAdapter
{
SampleFrame sampleframe ;
public MyWindowAdapter(SampleFrame sampleframe)
{
this.sampleframe = sampleframe;
}
public void windowClosing(WindowEvent we)
{
sampleframe.setVisible(false);
}
}
public class AppletFrame extends Applet
{
Frame f;
public void init()
{
f=new SampleFrame("A frame Window");
f.setSize(250,250);
f.setVisible(true);
}
public void start()
{
f.setVisible(true);
}
public void stop()
{
f.setVisible(false);
}
public void paint(Graphics g)
{
g.drawString("This is in Applet Window",10,20);
}
}
import java.awt.event.*;
import java.applet.*;
class SampleFrame extends Frame
{
SampleFrame(String title)
{
super(title);
MyWindowAdapter adapter = new MyWindowAdapter(this);
addWindowListener(adapter);
}
public void paint(Graphics g)
{
g.drawString("This in frame Window",10,40);
}
}
class MyWindowAdapter extends WindowAdapter
{
SampleFrame sampleframe ;
public MyWindowAdapter(SampleFrame sampleframe)
{
this.sampleframe = sampleframe;
}
public void windowClosing(WindowEvent we)
{
sampleframe.setVisible(false);
}
}
public class AppletFrame extends Applet
{
Frame f;
public void init()
{
f=new SampleFrame("A frame Window");
f.setSize(250,250);
f.setVisible(true);
}
public void start()
{
f.setVisible(true);
}
public void stop()
{
f.setVisible(false);
}
public void paint(Graphics g)
{
g.drawString("This is in Applet Window",10,20);
}
}