本文整理汇总了Python中java.awt.Color方法的典型用法代码示例。如果您正苦于以下问题:Python awt.Color方法的具体用法?Python awt.Color怎么用?Python awt.Color使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt
的用法示例。
在下文中一共展示了awt.Color方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_multiple_inheritance_prohibited
# 需要导入模块: from java import awt [as 别名]
# 或者: from java.awt import Color [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
示例2: test_serialization
# 需要导入模块: from java import awt [as 别名]
# 或者: from java.awt import Color [as 别名]
def test_serialization(self):
object1 = 42
object2 = ['a', 1, 1.0]
object3 = Foo()
object3.baz = 99
object4 = awt.Color(1, 2, 3)
#writing
fout = io.ObjectOutputStream(io.FileOutputStream(self.sername))
#Python int
fout.writeObject(object1)
#Python list
fout.writeObject(object2)
#Python instance
fout.writeObject(object3)
#Java instance
fout.writeObject(object4)
fout.close()
fin = io.ObjectInputStream(io.FileInputStream(self.sername))
#reading
iobject1 = fin.readObject()
iobject2 = fin.readObject()
iobject3 = fin.readObject()
iobject4 = fin.readObject()
fin.close()
self.assertEquals(iobject1, object1)
self.assertEquals(iobject2, object2)
self.assertEquals(iobject3.baz, 99)
self.assertEquals(iobject3.bar(), 'bar')
self.assertEquals(iobject3.__class__, Foo)
self.assertEquals(iobject4, object4)
示例3: initUI
# 需要导入模块: from java import awt [as 别名]
# 或者: from java.awt import Color [as 别名]
def initUI(self):
self.tab = swing.JPanel()
# UI for Output
self.outputLabel = swing.JLabel("LinkFinder Log:")
self.outputLabel.setFont(Font("Tahoma", Font.BOLD, 14))
self.outputLabel.setForeground(Color(255,102,52))
self.logPane = swing.JScrollPane()
self.outputTxtArea = swing.JTextArea()
self.outputTxtArea.setFont(Font("Consolas", Font.PLAIN, 12))
self.outputTxtArea.setLineWrap(True)
self.logPane.setViewportView(self.outputTxtArea)
self.clearBtn = swing.JButton("Clear Log", actionPerformed=self.clearLog)
self.exportBtn = swing.JButton("Export Log", actionPerformed=self.exportLog)
self.parentFrm = swing.JFileChooser()
# Layout
layout = swing.GroupLayout(self.tab)
layout.setAutoCreateGaps(True)
layout.setAutoCreateContainerGaps(True)
self.tab.setLayout(layout)
layout.setHorizontalGroup(
layout.createParallelGroup()
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup()
.addComponent(self.outputLabel)
.addComponent(self.logPane)
.addComponent(self.clearBtn)
.addComponent(self.exportBtn)
)
)
)
layout.setVerticalGroup(
layout.createParallelGroup()
.addGroup(layout.createParallelGroup()
.addGroup(layout.createSequentialGroup()
.addComponent(self.outputLabel)
.addComponent(self.logPane)
.addComponent(self.clearBtn)
.addComponent(self.exportBtn)
)
)
)