「Jython Swing はじめに」の版間の差分
ナビゲーションに移動
検索に移動
1行目: | 1行目: | ||
− | ==Jython Swing はじめに== | + | ==[[Jython Swing はじめに]]== |
[[Jython]] | [[Python]] | [[Jython Swing]] | [[Swing]] | | [[Jython]] | [[Python]] | [[Jython Swing]] | [[Swing]] | | ||
6行目: | 6行目: | ||
# -*- coding:utf-8 -*- | # -*- coding:utf-8 -*- | ||
− | from javax.swing import JFrame, JButton, JLabel | + | from javax.swing import [[JFrame]], JButton, JLabel |
− | from java.awt.BorderLayout import | + | from java.awt.BorderLayout import NO[[R]]TH |
def react(event): | def react(event): | ||
message.text = "Thanks for pushing the button" | message.text = "Thanks for pushing the button" | ||
− | frame = JFrame("My First Swing GUI", size=(300,150)) | + | frame = [[JFrame]]("My First Swing GUI", size=(300,150)) |
button = JButton("Push Me", actionPerformed=react) | button = JButton("Push Me", actionPerformed=react) | ||
frame.add(button) | frame.add(button) | ||
message = JLabel(" ") | message = JLabel(" ") | ||
− | frame.add(message, | + | frame.add(message, NO[[R]]TH) |
− | frame. | + | frame.[[vi]]sible = True |
=====例===== | =====例===== | ||
[[File:0751_jython_swing01.jpg]] | [[File:0751_jython_swing01.jpg]] |
2020年2月16日 (日) 04:28時点における最新版
Jython Swing はじめに
Jython | Python | Jython Swing | Swing |
ソース
# -*- coding:utf-8 -*- from javax.swing import JFrame, JButton, JLabel from java.awt.BorderLayout import NORTH def react(event): message.text = "Thanks for pushing the button" frame = JFrame("My First Swing GUI", size=(300,150)) button = JButton("Push Me", actionPerformed=react) frame.add(button) message = JLabel(" ") frame.add(message, NORTH) frame.visible = True
例
© 2006 矢木浩人