示例#1
0
    def run(self):
        frame = JFrame('MainFrame', defaultCloseOperation = JFrame.DISPOSE_ON_CLOSE)
        self.addButtons(frame.getContentPane())
        frame.size = (300, 175)
        frame.visible = 1 

        self.frame = frame
        self.startTimerTask()
示例#2
0
 def display(self):
     colnames = ['file', 'line']
     table = JTable(self.results, colnames)
     frame = JFrame("%i Results" % len(self.results))
     frame.getContentPane().add(table)
     frame.size = 400, 300
     frame.defaultCloseOperation = WindowConstants.EXIT_ON_CLOSE
     frame.visible = True
示例#3
0
#-------------------------------------------------------------------------------
#    Name: Welcome.py
#    From: Swing for Jython
#      By: Robert A. (Bob) Gibson [rag]
# ISBN-13: 978-1-4824-0818-2 (paperback)
# ISBN-13: 978-1-4824-0817-5 (electronic)
# website: http://www.apress.com/978148420818
#    Role: A simple, and straightforward script showing how to create a frame
#    Note: If executed using wsadmin, the script terminates immediately.
#          Using the close icon ('X' in top right corner) does not terminate
#          the script, so closing the command prompt window is suggested.
#   Usage: wsadmin -f Welcome.py
#            or
#          jython Welcome.py
# History:
#   date    who  ver   Comment
# --------  ---  ---  ----------
# 14/10/21  rag  0.0  New - ...
#-------------------------------------------------------------------------------
from javax.swing import JFrame
win = JFrame( 'Welcome to Jython Swing' )
win.size = ( 400, 100 )
win.show()
示例#4
0
 def show_data(self, event):
     frame = JFrame('%s Data' % self.view.network.name)
     frame.visible = True
     frame.add(timeview.data.DataPanel(self.view))
     frame.size = (500, 600)
示例#5
0
# Jython/PythonSwing.py
# The HTMLButton.java example from "Thinking in Java"
# converted into Jython.
from javax.swing import JFrame, JButton, JLabel
from java.awt import FlowLayout

frame = JFrame("HTMLButton", visible=1,
  defaultCloseOperation=JFrame.EXIT_ON_CLOSE)

def kapow(e):
    frame.contentPane.add(JLabel("<html>"+
      "<i><font size=+4>Kapow!"))
    # Force a re-layout to
    # include the new label:
    frame.validate()

button = JButton("<html><b><font size=+2>" +
  "<center>Hello!<br><i>Press me now!",
  actionPerformed=kapow)
frame.contentPane.layout = FlowLayout()
frame.contentPane.add(button)
frame.pack()
frame.size=200, 500
示例#6
0
from javax.swing import JFrame
from javax.swing import JLabel

frame = JFrame("Hello World Swing")
frame.defaultCloseOperation = JFrame.EXIT_ON_CLOSE

label = JLabel("Hello World")
frame.contentPane.add(label)

frame.pack()
frame.size = (300, 100)
frame.visible = True