| ページ一覧 | ブログ | twitter |  書式 | 書式(表) |

MyMemoWiki

「Jython Swing はじめに」の版間の差分

提供: MyMemoWiki
ナビゲーションに移動 検索に移動
 
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 NORTH
+
  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, NORTH)
+
  frame.add(message, NO[[R]]TH)
  frame.visible = True
+
  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

0751 jython swing01.jpg