File: class/Extras/Code/Internet/jpython-applet.py

#######################################
# a simple java applet coded in Python
#######################################

from java.applet import Applet                            # get java superclass

class Hello(Applet):
    def paint(self, gc):                                  # on paint callback
        gc.drawString("Hello applet world", 20, 30)       # draw text message

if __name__ == '__main__':                                # if run stand-alone
    import pawt                                           # get java awt lib
    pawt.test(Hello())                                    # run under awt loop



[Home page] Books Code Blog Python Author Train Find ©M.Lutz