Using an Applet as a Container
Because you can use applets interchangeably with panels they're easy to test and debug. Debugging is even easier if the applet runs as a standalone application rather than within a browser. Let's run one from the interactive interpreter.
Import Applet, List, and Frame.
>>> from java.applet import Applet >>> from java.awt import List, Frame
Create an instance of Applet and List; add the List instance to the applet instance.
>>> applet = Applet() >>> list = List() >>> applet.add(list) java.awt.List[list0,0,0,0x0,invalid,selected=null]
Create an instance of Frame; add applet to it.
>>> frame = Frame("Frame that contains the Applet") >>> frame.add(applet) java.applet.Applet[panel0,0,0,0x0,invalid,layout=java.awt.FlowLayout] ...
Get Python Programming with the Java™ Class Libraries: A Tutorial for Building Web and Enterprise Applications with Jython now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.