Python Programming with the Java™ Class Libraries: A Tutorial for Building Web and Enterprise Applications with Jython
by Richard Hightower
Properties
Sometimes properties are more complex than basic Java types—for example, a property can be a type of class. You can set properties that expect class instances with tuples that correspond to the constructor of the property type. (This only works for things like java.awt.Dimension.)
An example of this is the setSize() method of javax.swing.JFrame. The size property expects an instance of class Size, whose constructor expects width and height integer arguments.
The following code recaps what we've learned so far about using properties. We'll show how to create a frame and set its size property with a tuple, and we'll show the frame's visible property. Don't worry that you don't know JFC/Swing. I'll walk you through it.
Import the JFrame ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access