本文整理匯總了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)
)
)
)