本文整理汇总了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())