Dialogs

This page is currently putting up with massive transmutation and that is precisely why only the lonely code will have to make do. We will be back here soon, but till then, Thanx for visiting this page. If you are a member of the Java-crazed community, you can still try out the code furnished here. Maybe with some divine intervention you might be able to get the drift...

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

import java.awt.*;
import java.applet.*;
Program 1
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;
        }
}


Unless you want to get back to your favourite pastime of jamming miniature marshmallows up your nose, rush to the Next topic "An Eventful Onset" or just jam your comments, feedback, suggestions et al to us right offhand...

Back to our Java page


Vijay Mukhi's Computer Institute
B-13, Everest Building, Tardeo, Bombay 400 034, India.
http://www.neca.com/~vmis
e-mail : vmukhi@giasbm01.vsnl.net.in
1