Size: 1118
Comment: converted to 1.6 markup
|
← Revision 5 as of 2012-05-18 17:09:11 ⇥
Size: 1264
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 1: | Line 1: |
[Java]로 만든 [Python]. Seminar:Jython | [[Java]]로 만든 [[Python]]. Seminar:Jython |
Line 5: | Line 5: |
[Python]문법으로, [Java]객체들을 불러다가 쓸수 있다. 전형적인 ProgrammingLanguage의 HybridTheCreativeOntology. | [[Python]]문법으로, [[Java]]객체들을 불러다가 쓸수 있다. 전형적인 ProgrammingLanguage의 HybridTheCreativeOntology. |
Line 7: | Line 7: |
JythonEssentials에 나오는 [Swing]기초예제. | 관련자료 * [[http://www.slideshare.net/fwierzbicki/jython-update-2012|Jython 2.7 and techniques for integrating with Java]] JythonEssentials에 나오는 [[Swing]]기초예제. |
Python문법으로, Java객체들을 불러다가 쓸수 있다. 전형적인 ProgrammingLanguage의 HybridTheCreativeOntology.
관련자료
JythonEssentials에 나오는 Swing기초예제.
1 import java.lang as lang
2 import javax.swing as swing
3 import java.awt as awt
4
5 names = ["Groucho","Chico","Harpo"]
6 quotes = {"Groucho": "Say the secret word",
7 "Chico": "Viaduct?",
8 "Harpo": "HONK!"}
9
10 def buttonPressed(event):
11 field.text = quotes[event.source.text]
12
13 def exit(event):
14 lang.System.exit(0)
15
16 def createButton(name):
17 return swing.JButton(name, preferredSize=(100,20),
18 actionPerformed = buttonPressed)
19
20 win = swing.JFrame("Welcome to Jython", size=(100,20), windowClosing=exit)
21 win.contentPane.layout = awt.FlowLayout()
22
23 field = swing.JTextField(preferredSize=(200,20))
24 win.contentPane.add(field)
25
26 buttons = [createButton(each) for each in names]
27 for eachButton in buttons:
28 win.contentPane.add(eachButton)
29
30 win.pack()
31 win.show()