Anonymous avatar Anonymous committed 5edbb51 Draft

Building JPython repository

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 
+"""
+
+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)
+
+frame = awt.Frame("A test")
+button = awt.Button("Close Me!")
+button.addActionListener(action(frame))
+frame.add(button, "Center")
+frame.pack()
+frame.setVisible(1)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.