当前位置: 首页>>代码示例>>Python>>正文


Python JComboBox.setBorder方法代码示例

本文整理汇总了Python中javax.swing.JComboBox.setBorder方法的典型用法代码示例。如果您正苦于以下问题:Python JComboBox.setBorder方法的具体用法?Python JComboBox.setBorder怎么用?Python JComboBox.setBorder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.JComboBox的用法示例。


在下文中一共展示了JComboBox.setBorder方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: EditSymbolAttr

# 需要导入模块: from javax.swing import JComboBox [as 别名]
# 或者: from javax.swing.JComboBox import setBorder [as 别名]
class EditSymbolAttr(JPanel):
    def __init__(self, sattr):
	self.attr = sattr
	self.cbox = JColorChooser(self.attr.color)
	self.sz_field = JTextField(str(self.attr.size))
	szpanel = JPanel()
	szpanel.add(self.sz_field)
	szpanel.setBorder(BorderFactory.createTitledBorder("symbol size (integer)"))
	self.filled_box = JCheckBox("Filled ?:",self.attr.filled)
	self.shape_cbox = JComboBox(SymbolProps.sym_shape_map.keys())
	self.shape_cbox.setSelectedItem(self.attr.shape)
	self.shape_cbox.setBorder(BorderFactory.createTitledBorder("Shape"))
	panel1 = JPanel()
	panel1.setLayout(BorderLayout())
	panel1.add(szpanel,BorderLayout.NORTH)
	panel2 = JPanel()
	panel2.setLayout(GridLayout(1,2))
	panel2.add(self.shape_cbox)
	panel2.add(self.filled_box)
	panel1.add(panel2,BorderLayout.SOUTH)
	self.setLayout(BorderLayout())
	self.add(self.cbox,BorderLayout.CENTER)
	self.add(panel1,BorderLayout.SOUTH)
    def setAttribute(self,sattr):
	self.attr = sattr
	self.cbox.color = self.attr.color
	self.sz_field.text = str(self.attr.size)
	self.shape_cbox.setSelectedItem(self.attr.shape)
    def update(self):
	self.attr.color = self.cbox.getColor()
	self.attr.size = string.atoi(self.sz_field.getText())
	self.attr.filled = self.filled_box.isSelected()
	self.attr.shape = self.shape_cbox.getSelectedItem()
	self.attr.sym = self.attr.createSymbol()
开发者ID:CalSimCalLite,项目名称:CalLiteGUI,代码行数:36,代码来源:xattr.py

示例2: EditCurveAttr

# 需要导入模块: from javax.swing import JComboBox [as 别名]
# 或者: from javax.swing.JComboBox import setBorder [as 别名]
class EditCurveAttr(JPanel):
    def __init__(self, cattr):
	self.attr = cattr
	self.cbox = JColorChooser(self.attr.color)
	self.sym_panel = EditSymbolAttr(cattr.sym_prop)
	self.thickness_field = JTextField(str(cattr.thickness),2)
	self.draw_symbol_box = JCheckBox("Draw Symbol?",cattr.draw_symbol)
	self.dps_field = JTextField(str(self.attr.data_per_symbol),2)
	self.dash_box = JComboBox(CurveProps.DASH_TYPES.keys())
	self.dash_box.setSelectedItem(self.attr.dash_type)
	self.dash_box.setBorder(BorderFactory.createTitledBorder("Dash type: (Only JDK2 & Slow!)"))
	tpanelx = JPanel()
	tpanelx.add(self.thickness_field)
	tpanelx.setBorder(BorderFactory.createTitledBorder("curve thickness (integer)"))
	tpanely = JPanel()
	tpanely.add(self.dps_field)
	tpanely.setBorder(BorderFactory.createTitledBorder("data per symbol(integer)"))
	tpanel = JPanel();tpanel.setLayout(GridLayout(2,2));
	tpanel.add(self.draw_symbol_box); tpanel.add(tpanelx);
	tpanel.add(tpanely); tpanel.add(self.dash_box);
	panel1 = JPanel()
	panel1.setLayout(BorderLayout())
	panel1.add(self.cbox,BorderLayout.CENTER)
	panel1.add(tpanel, BorderLayout.SOUTH)
	panel2 = JPanel()
	panel2.setLayout(BorderLayout())
	panel2.add(self.sym_panel,BorderLayout.CENTER)
	tp1 = JTabbedPane()
	tp1.addTab("Curve Attributes",panel1)
	tp1.addTab("Symbol Attributes",panel2)
	tp1.setSelectedComponent(panel1)
	self.setLayout(BorderLayout())
	self.add(tp1,BorderLayout.CENTER)
    def setAttribute(self,cattr):
	self.attr = cattr
	self.cbox.color = self.attr.color
	self.sym_panel.setAttribute(cattr.sym_prop)
	self.thickness_field.text = str(cattr.thickness)
	self.dps_field.text = str(cattr.data_per_symbol)
	self.draw_symbol_box.setSelected(cattr.draw_symbol)
	self.dash_box.setSelectedItem(cattr.dash_type)
    def update(self):
	self.attr.color = self.cbox.getColor()
	self.attr.thickness = string.atoi(self.thickness_field.text)
	self.attr.data_per_symbol = string.atoi(self.dps_field.text)
	self.attr.draw_symbol = self.draw_symbol_box.isSelected()
	self.attr.dash_type = self.dash_box.getSelectedItem()
	#print 'Updating Self.draw_symbol',self.draw_symbol,self.attr
	self.sym_panel.update()
开发者ID:CalSimCalLite,项目名称:CalLiteGUI,代码行数:51,代码来源:xattr.py

示例3: CurveDialog

# 需要导入模块: from javax.swing import JComboBox [as 别名]
# 或者: from javax.swing.JComboBox import setBorder [as 别名]
class CurveDialog(JDialog):
    def __init__(self, cattrs):
	#JDialog.__init__(self,"Curve Attribute Editor")
	#("Curve Attribute Editor")
	if cattrs == None or len(cattrs) == 0:
	    raise "No curve attributes specified"
	self.attrs = cattrs
	self.cpanel = EditCurveAttr(cattrs[0])
	pane = self.getContentPane()
	pane.setLayout(BorderLayout())
	x = map(lambda x: x+1,range(len(self.attrs)))
	self.curveBox = JComboBox(x)
	self.curveBox.setBorder(BorderFactory.createTitledBorder("Curve #"))
	self.curveBox.setSelectedItem(0)
	class CListener(ItemListener):
	    def __init__(self,cbox,cpanel,cattrs):
		self.cbox = cbox
		self.cpanel = cpanel
		self.attrs = cattrs
	    def itemStateChanged(self, evt):
		crvNo = self.cbox.getSelectedItem()
		self.cpanel.update()
		self.cpanel.setAttribute(self.attrs[crvNo-1])
	self.curveBox.addItemListener(CListener(self.curveBox, self.cpanel,self.attrs))
	okBtn = JButton("OK",actionPerformed=self.ok_action)
	cancelBtn = JButton("Cancel",actionPerformed=self.cancel_action)
	btnPanel = JPanel()
	btnPanel.setLayout(GridLayout(1,3))
	btnPanel.add(self.curveBox)
	btnPanel.add(okBtn)
	btnPanel.add(cancelBtn)
	pane.add(self.cpanel,BorderLayout.CENTER)
	pane.add(btnPanel, BorderLayout.SOUTH)
	self.setLocation(100,100)
	self.pack()
	self.setVisible(1)
    def ok_action(self,evt):
	#crvNo = self.curveBox.getSelectedItem()
	#print 'Setting attributes for ', crvNo
	#print self.attrs[crvNo-1]
	self.cpanel.update()
	self.cancel_action(evt)
    def cancel_action(self,evt):
	self.dispose()
开发者ID:CalSimCalLite,项目名称:CalLiteGUI,代码行数:46,代码来源:xattr.py


注:本文中的javax.swing.JComboBox.setBorder方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。