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


Python JTable.getCellRenderer方法代码示例

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


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

示例1: __init__

# 需要导入模块: from javax.swing import JTable [as 别名]
# 或者: from javax.swing.JTable import getCellRenderer [as 别名]
class LINAC_SetUp_Controller:
	def __init__(self,linac_wizard_document):
		#--- linac_wizard_document the parent document for all controllers
		self.linac_wizard_document = linac_wizard_document		
		self.main_panel = JPanel(BorderLayout())
		#----etched border
		etched_border = BorderFactory.createEtchedBorder()		
		#------tables with Seq. names and button
		tables_panel = JPanel(BorderLayout())
		tables_panel.setBorder(etched_border)
		self.first_table = JTable(WS_Records_Table_Model("First "))
		self.last_table = JTable(WS_Records_Table_Model("Last "))
		self.first_table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION)
		self.last_table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION)
		self.first_table.setFillsViewportHeight(true)
		self.last_table.setFillsViewportHeight(true)
		tables01_panel = JPanel(BorderLayout())
		scrl_panel0 = JScrollPane(self.first_table)
		scrl_panel1 = JScrollPane(self.last_table)
		#tables01_panel.add(JScrollPane(self.first_table),BorderLayout.WEST)
		#tables01_panel.add(JScrollPane(self.last_table),BorderLayout.EAST)
		self.first_table.getCellRenderer(0,0).setHorizontalAlignment(JLabel.CENTER)
		self.last_table.getCellRenderer(0,0).setHorizontalAlignment(JLabel.CENTER)
		self.first_table.setPreferredScrollableViewportSize(Dimension(120,300))
		self.last_table.setPreferredScrollableViewportSize(Dimension(120,300))
		tables01_panel.add(scrl_panel0,BorderLayout.WEST)
		tables01_panel.add(scrl_panel1,BorderLayout.EAST)	
		tables_button_panel = JPanel(BorderLayout())
		tables_button_panel.add(tables01_panel,BorderLayout.WEST)
		seq_button_panel = JPanel(FlowLayout(FlowLayout.CENTER,5,5))
		seq_set_button = JButton(" Set ComboSequence ")	
		seq_button_panel.add(seq_set_button)
		tables_button_panel.add(seq_button_panel,BorderLayout.SOUTH)
		tables_panel.add(tables_button_panel,BorderLayout.NORTH)
		self.main_panel.add(tables_panel,BorderLayout.WEST)
		#--------central panel-------
		cav_amp_phase_button = JButton(" Read Cavities Amp.&Phases from Ext. File ")	
		cav_info_from_scl_tuneup_button = JButton("Get SCL Cav. Amp.&Phases from SCL Long. TuneUp")	
		new_accelerator_button = JButton(" Setup a New Accelerator File ")
		center_buttons_panel0 = JPanel(FlowLayout(FlowLayout.CENTER,5,5))
		center_buttons_panel0.add(cav_amp_phase_button)
		center_buttons_panel1 = JPanel(FlowLayout(FlowLayout.CENTER,5,5))
		center_buttons_panel1.add(cav_info_from_scl_tuneup_button)			
		center_buttons_panel2 = JPanel(FlowLayout(FlowLayout.CENTER,5,5))
		center_buttons_panel2.add(new_accelerator_button)	
		center_buttons_panel = JPanel(GridLayout(3,1))
		center_buttons_panel.add(center_buttons_panel0)
		center_buttons_panel.add(center_buttons_panel1)
		center_buttons_panel.add(center_buttons_panel2)
		center_panel = JPanel(BorderLayout())		
		center_panel.add(center_buttons_panel,BorderLayout.NORTH)
		self.main_panel.add(center_panel,BorderLayout.CENTER)
		#---------add actions listeners
		seq_set_button.addActionListener(Make_Sequence_Listener(self))
		cav_amp_phase_button.addActionListener(Read_Cav_Amp_Phase_Dict_Listener(self))
		cav_info_from_scl_tuneup_button.addActionListener(Get_SCL_Cav_Amp_Phase_Listener(self))
		new_accelerator_button.addActionListener(SetUp_New_Accelerator_Listener(self))	
		
	def getMainPanel(self):
		return self.main_panel
		
	def setSelectedSequences(self,first_seq_name,last_seq_name):
		index0 = self.first_table.getModel().accSeqName_arr.index(first_seq_name)
		index1 = self.last_table.getModel().accSeqName_arr.index(last_seq_name)
		self.first_table.setRowSelectionInterval(index0,index0)
		self.last_table.setRowSelectionInterval(index1,index1)
		
	def getSelectedSequencesNames(self):
		first_table = self.first_table
		index0 = first_table.getSelectedRow()
		last_table = self.last_table
		index1 = last_table.getSelectedRow()
		if(index0 < 0 or index1 < 0): return []
		seq_names = []
		if(index0 == index1):
			seq_names.append(first_table.getModel().accSeqName_arr[index0])
		else:
			if(index1 < index0):
				(index0,index1) = (index1,index0)
			for i in range(index0,index1+1):
				seq_names.append(first_table.getModel().accSeqName_arr[i])
		return seq_names
		
	def setAccSeqNames(self,seq_names):
		accl = self.linac_wizard_document.getAccl()
		if(len(seq_names) == 0): 
			accSeq = null
			self.linac_wizard_document.setAccSeq(accSeq)
			return
		lst = ArrayList()
		for seqName in seq_names:
			lst.add(accl.getSequence(seqName))
		accSeq = AcceleratorSeqCombo("SEQUENCE", lst)	
		self.linac_wizard_document.setAccSeq(accSeq)
		
	def getCavNameNodeDict(self,accl):
		rf_gaps = accl.getAllNodesWithQualifier(AndTypeQualifier().and((OrTypeQualifier()).or(RfGap.s_strType)))	
		cavs = []
		for rf_gap in rf_gaps:
			cav = rf_gap.getParent()
#.........这里部分代码省略.........
开发者ID:kritha,项目名称:MyOpenXal,代码行数:103,代码来源:linac_setup_cntrl_lib.py


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