本文整理匯總了Python中java.awt.Dimension方法的典型用法代碼示例。如果您正苦於以下問題:Python awt.Dimension方法的具體用法?Python awt.Dimension怎麽用?Python awt.Dimension使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.awt
的用法示例。
在下文中一共展示了awt.Dimension方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_get_set
# 需要導入模塊: from java import awt [as 別名]
# 或者: from java.awt import Dimension [as 別名]
def test_get_set(self):
d = Dimension(3, 9)
self.assertEquals(d.width, 3)
self.assertEquals(d.height, 9)
d.width = 42
self.assertEquals(d.width, 42)
self.assertEquals(d.height, 9)
try:
d.foo
except AttributeError:
pass
else:
raise AssertionError('d.foo should throw type error')
# Used in test_java_bean_properties.
示例2: test_multiple_inheritance_prohibited
# 需要導入模塊: from java import awt [as 別名]
# 或者: from java.awt import Dimension [as 別名]
def test_multiple_inheritance_prohibited(self):
try:
class MultiJava(Dimension, Color):
pass
self.fail("Shouldn't be able to subclass more than one concrete java class")
except TypeError:
pass
class PyDim(Dimension):
pass
class PyDimRun(PyDim, Runnable):
pass
try:
class PyDimRunCol(PyDimRun, Color):
pass
self.fail("Shouldn't be able to subclass more than one concrete java class")
except TypeError:
pass
示例3: p_build_ui
# 需要導入模塊: from java import awt [as 別名]
# 或者: from java.awt import Dimension [as 別名]
def p_build_ui(self, event):
"""
Adds a list of checkboxes, one for each loaded plugin
to the Selct plugins window
"""
if not self.loaded_p_list:
self.update_scroll("[!!] No plugins loaded!")
return
scroll_pane = JScrollPane()
scroll_pane.setPreferredSize(Dimension(200, 250))
check_frame = JPanel(GridBagLayout())
constraints = GridBagConstraints()
constraints.fill = GridBagConstraints.HORIZONTAL
constraints.gridy = 0
constraints.anchor = GridBagConstraints.FIRST_LINE_START
for plug in self.loaded_p_list:
check_frame.add(JCheckBox(plug.get_name(), plug.enabled,
actionPerformed=self.update_box),
constraints)
constraints.gridy += 1
vport = JViewport()
vport.setView(check_frame)
scroll_pane.setViewport(vport)
self.window.contentPane.add(scroll_pane)
self.window.pack()
self.window.setVisible(True)
示例4: test
# 需要導入模塊: from java import awt [as 別名]
# 或者: from java.awt import Dimension [as 別名]
def test(panel, size=None, name='AWT Tester'):
f = awt.Frame(name, windowClosing=lambda event: sys.exit(0))
if hasattr(panel, 'init'):
panel.init()
f.add('Center', panel)
f.pack()
if size is not None:
f.setSize(apply(awt.Dimension, size))
f.setVisible(1)
return f
示例5: test
# 需要導入模塊: from java import awt [as 別名]
# 或者: from java.awt import Dimension [as 別名]
def test(panel, size=None, name='Swing Tester'):
f = swing.JFrame(name, windowClosing=lambda event: sys.exit(0))
if hasattr(panel, 'init'):
panel.init()
f.contentPane.add(panel)
f.pack()
if size is not None:
from java import awt
f.setSize(apply(awt.Dimension, size))
f.setVisible(1)
return f
示例6: test_class_in_failed_constructor
# 需要導入模塊: from java import awt [as 別名]
# 或者: from java.awt import Dimension [as 別名]
def test_class_in_failed_constructor(self):
try:
Dimension(123, 456, 789)
except TypeError, exc:
self.failUnless("java.awt.Dimension" in exc.message)
示例7: test_awt_hack
# 需要導入模塊: from java import awt [as 別名]
# 或者: from java.awt import Dimension [as 別名]
def test_awt_hack(self):
# We ignore several deprecated methods in java.awt.* in favor of bean properties that were
# addded in Java 1.1. This tests that one of those bean properties is visible.
c = Container()
c.size = 400, 300
self.assertEquals(Dimension(400, 300), c.size)
示例8: test_auto_super
# 需要導入模塊: from java import awt [as 別名]
# 或者: from java.awt import Dimension [as 別名]
def test_auto_super(self):
class Implicit(Rectangle):
def __init__(self):
self.size = Dimension(6, 7)
class Explicit(Rectangle):
def __init__(self):
Rectangle.__init__(self, 6, 7)
self.assert_("width=6,height=7" in Implicit().toString())
self.assert_("width=6,height=7" in Explicit().toString())