Commits

Anonymous committed 0caff43

Update for new beans-like style

  • Participants
  • Parent commits 49a9c8d

Comments (0)

Files changed (1)

Demo/awt/simple.py

 """\
 This is a very simple example of using Java's AWT from JPython.
-I expect that there will be a much higher level of accessing the
-AWT in future releases of the system.
 
-This example 
+Many more examples can be found in Demo/applet.  While all of those
+demos are designed as applets, they can also be run as applications
+and they all show how to use different parts of the AWT.
 """
 
 import java
 from java import awt
 
-class action(awt.event.ActionListener):
-	def __init__(self, frame):
-		self.frame = frame
-		
-	def actionPerformed(self,event):
-		if event.getActionCommand() == "Close Me!": 
-			java.lang.System.exit(0)
+def exit(e): java.lang.System.exit(0)
 
-frame = awt.Frame("A test")
-button = awt.Button("Close Me!")
-button.addActionListener(action(frame))
-frame.add(button, "Center")
+frame = awt.Frame('AWT Example', visible=1)
+button = awt.Button('Close Me!', actionPerformed=exit)
+frame.add(button, 'Center')
 frame.pack()
-frame.setVisible(1)