# MicroscopeApplet.py : Starting module for the microscope client
#
# Distributed under the terms described in the LICENCE file.
#
# Developed by akuchlin@mems-exchange.org
#
# This module is the starting point for the microscope GUI.  It
# defines a subclass of java.applet.Applet, which can be used to run
# the client from inside a Web browser, and also provides main-line
# code for running the client as a standalone application.
#

__revision__ = "$Id: MicroscopeApplet.py,v 1.16 2002/01/03 18:53:23 akuchlin Exp $"

from java import awt
from java.applet import Applet
import PyClient 

class MicroscopeApplet(Applet):
    def init (self):
	# Get the applet parameters
        self.user_id = self.getParameter('user_id')
        self.hostname = self.getParameter('hostname')
        self.port = self.getParameter('port')
        self.authtoken = self.getParameter('authtoken')

    def start (self):
	self.client = PyClient.PyClient()
        self.client.init(self.hostname, int(self.port),
                         self.authtoken, self.user_id, 
                         applet=self, show_chat=1)
        self.client.pack()
        self.client.validate()
        self.client.show()
        self.client.make_connection()

    def stop (self):
        print 'stop called'
        self.client.quit()
        del self.client
        
    def destroy (self):
        print 'destroy called'

        
