Every time a bold line of the code appears in the programs, consider it to be the new addition to the previous program.
The import statements for the programs
Program 1import java.awt.*; import java.applet.*;
import java.awt.*;
import java.applet.*;
public class zzz extends Applet
{ Frame f;
Window w;
public void init()
{ f = new Frame("hello");
add(new Button("Begin"));
w = new Window(f);
}
public boolean action ( Event e, Object o)
{ if (o == "Begin")
{ f.show();
w.show();
}
return false;
}
}
Program 2
public class zzz extends Applet
{ Dialog d;
Frame f;
Window w;
public void init()
{ f = new Frame("hello");
add(new Button("Begin"));
w = new Window(f);
d=new Dialog(f,true);
}
public boolean action ( Event e, Object o)
{ if (o == "Begin")
{ f.show();
w.show();
d.show();
}
return false;
}
}
Program 3
public class zzz extends Applet
{ Dialog d;
Frame f;
Window w;
public void init()
{ f = new Frame("hello");
add(new Button("Begin"));
w = new Window(f);
d=new Dialog(f,true);
}
public boolean action ( Event e, Object o)
{ if (o == "Begin")
{ f.show();
d.show();
}
return false;
}
}
Program 4
class xxx extends Dialog
{ public xxx(Frame f, boolean t)
{ super(f,t);
add("North",new Button("Hell"));
}
}
public class zzz extends Applet
{ xxx d;
Frame f;
Window w;
public void init()
{ f = new Frame("hello");
add(new Button("Begin"));
w = new Window(f);
d=new xxx(f,true);
}
public boolean action ( Event e, Object o)
{ if (o == "Begin")
{ f.show();
d.show();
}
return false;
}
}
Program 5
class xxx extends Dialog
{ public xxx(Frame f, boolean t)
{ super(f,t);
add("North",new Button("Hell"));
}
public boolean action ( Event e, Object o)
{ if (o == "Hell")
{ System.out.println(" clicked on Hell");
}
return false;
}
}
public class zzz extends Applet
{ xxx d;
Frame f;
Window w;
public void init()
{ f = new Frame("hello");
add(new Button("Begin"));
w = new Window(f);
d=new xxx(f,true);
}
public boolean action ( Event e, Object o)
{ if (o == "Begin")
{ f.show();
d.show();
}
return false;
}
}