Hi all,
        i am relatively new to Java and i am trying to learn the UI (or
the awt). Below is the code that i compiled ...
-------------------Code begins -------------------------------------------
import java.awt.*;
import java.awt.event.*;
import java.applet.*;

public class Buttons extends Applet
{
    private Button btnOk, btnExit;
    ActionListener myLis_Exit = new ActionListener()
    {
        public void actionPerformed(ActionEvent e)
        {
            stop();
            destroy();
            System.exit(0);
        }
    };
   
    ActionListener myLis_Ok = new ActionListener()
    {
        public void actionPerformed(ActionEvent e)
        {
            System.out.println("This is Ok");
        }
    };
   
    public void init()
    {
        btnOk = new Button("Ok");
        btnExit = new Button("Exit");
        btnExit.addActionListener(myLis_Exit);
        btnOk.addActionListener(myLis_Ok);

        add(btnOk);
        add(btnExit);

    } //void init();

} //public class Buttons extends Applet

----------------Code Ends----------------------------------

        The code compiles ok, but then when i click on the "Exit" in the
appletviewer i get a load of exceptions thrown. If the System.exit() is
commented out, the applet still does not close. 

1. how do i terminate an applet?

2. If i click the middle-mouse btn (btn# 3), the appletviewer crashes. 

I run RedHat 5.1 on a P2-400. 

Thanks,
-Karthik.

+------------------------------------------------------------------------+
|  Karthik Vishwanath          |  National Centre for Biological Sciences|
|  [EMAIL PROTECTED] |  TIFR Centre, IISc Campus, PO Box 1234  |
|  80-334-5615 or 4062 or 3035 |  Bangalore 560012, INDIA                |
|  Fax 80-334-3851             |                                         |
+------------------------------------------------------------------------+

Reply via email to