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


Python JTable.setPreferredScrollableViewportSize方法代码示例

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


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

示例1: __init__

# 需要导入模块: from javax.swing import JTable [as 别名]
# 或者: from javax.swing.JTable import setPreferredScrollableViewportSize [as 别名]
class QuadCavDictSelection_Panel	(JPanel):
	def __init__(self,transverse_twiss_analysis_Controller):
		self.transverse_twiss_analysis_Controller = transverse_twiss_analysis_Controller
		self.setLayout(BorderLayout())
		#-----------dict table panel
		etched_border = BorderFactory.createEtchedBorder()
		border = BorderFactory.createTitledBorder(etched_border,"Quad and Cavities Amp.&Phases Sets")
		self.setBorder(border)		
		self.quad_cav_dict_table_model = QuadCavDict_Table_Model(self.transverse_twiss_analysis_Controller.accStatesKeeper)
		self.dict_table = JTable(self.quad_cav_dict_table_model)
		self.dict_table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION)
		self.dict_table.setFillsViewportHeight(true)
		self.dict_table.setPreferredScrollableViewportSize(Dimension(120,100))
		self.dict_table.getSelectionModel().addListSelectionListener(QuadCavDict_Table_Selection_Listener(self.transverse_twiss_analysis_Controller))
		#--------buttons panel
		button_panel = JPanel(BorderLayout())
		self.gaussButton = JRadioButton("Use Ext. Gauss Fit")
		self.custom_gaussButton = JRadioButton("Use Gauss Fit")
		self.custom_rmsButton = JRadioButton("Use RMS")
		button_group = ButtonGroup()
		button_group.add(self.gaussButton)
		button_group.add(self.custom_gaussButton)
		button_group.add(self.custom_rmsButton)
		button_group.clearSelection()
		self.gaussButton.setSelected(true)
		button_panel0 = JPanel(FlowLayout(FlowLayout.LEFT,2,2))
		button_panel0.add(self.gaussButton)
		button_panel1 = JPanel(FlowLayout(FlowLayout.LEFT,2,2))
		button_panel1.add(self.custom_gaussButton)
		button_panel2 = JPanel(FlowLayout(FlowLayout.LEFT,2,2))
		button_panel2.add(self.custom_rmsButton)
		button_panel012 = JPanel(GridLayout(3,1))
		button_panel012.add(button_panel0)
		button_panel012.add(button_panel1)
		button_panel012.add(button_panel2)
		#-------new buttons-----
		button_bottom_panel = JPanel(FlowLayout(FlowLayout.LEFT,2,2))
		button_bottom_panel0 = JPanel(GridLayout(3,1,2,2))
		dump_quad_fields_button = JButton("Dump Quad Fields to ASCII")
		dump_quad_fields_button.addActionListener(Dump_Quad_Fields_Button_Listener(self.transverse_twiss_analysis_Controller))
		button_bottom_panel0.add(dump_quad_fields_button)
		dump_cav_amps_phases_button = JButton("Dump. Cav Amps. Phases to ASCII")
		dump_cav_amps_phases_button.addActionListener(Dump_Cav_Amps_Phases_Button_Listener(self.transverse_twiss_analysis_Controller))
		button_bottom_panel0.add(dump_cav_amps_phases_button)	
		read_cav_amps_phases_button = JButton("Read Cav Amps. Phases from ASCII")
		read_cav_amps_phases_button.addActionListener(Read_Cav_Amps_Phases_Button_Listener(self.transverse_twiss_analysis_Controller))
		button_bottom_panel0.add(read_cav_amps_phases_button)
		button_bottom_panel.add(button_bottom_panel0)
		#----- final knobs panel 
		button_panel.add(button_panel012,BorderLayout.NORTH)
		button_panel.add(button_bottom_panel,BorderLayout.SOUTH)
		self.gaussButton.addActionListener(FitParam_Buttons_Listener(self.transverse_twiss_analysis_Controller,0))
		self.custom_gaussButton.addActionListener(FitParam_Buttons_Listener(self.transverse_twiss_analysis_Controller,1))
		self.custom_rmsButton.addActionListener(FitParam_Buttons_Listener(self.transverse_twiss_analysis_Controller,2))
		#----------------------------------------------------------
		self.add(JScrollPane(self.dict_table), BorderLayout.WEST)
		self.add(button_panel, BorderLayout.CENTER)

	def getMainPanel(self):
		return self
开发者ID:kritha,项目名称:MyOpenXal,代码行数:62,代码来源:transverse_twiss_analysis_cntrl_lib.py

示例2: __init__

# 需要导入模块: from javax.swing import JTable [as 别名]
# 或者: from javax.swing.JTable import setPreferredScrollableViewportSize [as 别名]
class SCL_Long_TuneUp_PhaseScan_Controller:
	def __init__(self,scl_long_tuneup_controller):
		#--- scl_long_tuneup_controller the parent document for all SCL tune up controllers
		self.scl_long_tuneup_controller = 	scl_long_tuneup_controller	
		self.main_panel = JPanel(BorderLayout())
		#----etched border
		etched_border = BorderFactory.createEtchedBorder()			
		#------top params panel-----------------------
		top_params_panel = JPanel(BorderLayout())
		self.set_phase_shift_panel = SetPhaseShiftAndTimeStep_Panel(self.scl_long_tuneup_controller)
		self.start_stop_scan_panel = StartStopPhaseScan_Panel(self.scl_long_tuneup_controller)
		top_params_panel.add(self.set_phase_shift_panel,BorderLayout.NORTH)
		top_params_panel.add(self.start_stop_scan_panel,BorderLayout.SOUTH)
		#------cavities scan table panel --------
		cavs_scan_panel = JPanel(BorderLayout())
		self.cavs_table = JTable(Cavs_PhaseScan_Table_Model(self.scl_long_tuneup_controller))
		self.cavs_table.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION)
		self.cavs_table.setFillsViewportHeight(true)
		self.cavs_table.getSelectionModel().addListSelectionListener(Cavs_Table_Selection_Listener(self.scl_long_tuneup_controller))		
		self.bpms_table_model = PhaseScan_BPMs_Table_Model(self.scl_long_tuneup_controller)
		self.bpms_table = JTable(self.bpms_table_model)
		self.bpms_table.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION)
		self.bpms_table.setFillsViewportHeight(true)	
		self.bpms_table.getSelectionModel().addListSelectionListener(BPMs_Table_Selection_Listener(self.scl_long_tuneup_controller))	
		self.bpms_table.setPreferredScrollableViewportSize(Dimension(200,300))
		scrl_panel0 = JScrollPane(self.cavs_table)
		scrl_panel0.setBorder(etched_border)
		scrl_panel1 = JScrollPane(self.bpms_table)
		self.bpm_table_border = BorderFactory.createTitledBorder(etched_border,"Cavity")
		scrl_panel1.setBorder(self.bpm_table_border)
		cavs_scan_panel.add(scrl_panel0,BorderLayout.CENTER)
		cavs_scan_panel.add(scrl_panel1,BorderLayout.EAST)
		self.bpm_table_panel = scrl_panel1
		#---------- graph panels --------------------------
		self.bpm_phaseDiff_graph_panel = BPM_PhaseDiff_Graph_Panel(self.scl_long_tuneup_controller)
		self.bpm_phase_and_amp_graph_panel = BPMs_Amp_Phase_Graphs_Panel(self.scl_long_tuneup_controller)
		grap_panel = JPanel(GridLayout(1,2))
		grap_panel.add(self.bpm_phaseDiff_graph_panel)		
		grap_panel.add(self.bpm_phase_and_amp_graph_panel)
		#--------center panel = graphs + tables-------------
		center_panel = JPanel(GridLayout(2,1))
		center_panel.add(cavs_scan_panel)
		center_panel.add(grap_panel)
		#-------- post-scan filtering panel
		bottom_panel = JPanel(BorderLayout())
		self.post_scan_panel = PostPhaseScanActions_Panel(self.scl_long_tuneup_controller)
		bottom_panel.add(self.post_scan_panel,BorderLayout.WEST)
		#--------------------------------------------------
		self.main_panel.add(top_params_panel,BorderLayout.NORTH)
		self.main_panel.add(bottom_panel,BorderLayout.SOUTH)
		self.main_panel.add(center_panel,BorderLayout.CENTER)
		#------scan state
		self.scan_state_controller = ScanStateController()
		
	def getMainPanel(self):
		return self.main_panel
开发者ID:kritha,项目名称:MyOpenXal,代码行数:58,代码来源:scl_long_tuneup_phase_scan_cntrl_lib.py

示例3: __init__

# 需要导入模块: from javax.swing import JTable [as 别名]
# 或者: from javax.swing.JTable import setPreferredScrollableViewportSize [as 别名]
class RF_NET_Power_Controller:
	def __init__(self,top_document,main_loop_controller):
		#--- top_document is a parent document for all controllers
		self.top_document = top_document		
		self.main_loop_controller = main_loop_controller
		self.main_panel = JPanel(BorderLayout())
		#----etched border
		etched_border = BorderFactory.createEtchedBorder()
		#----------------------------------------------
		left_panel = JPanel(BorderLayout())
		self.rf_power_table = JTable(RF_Power_Table_Model(self))
		self.rf_power_table.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION)
		self.rf_power_table.setFillsViewportHeight(true)
		self.rf_power_table.setPreferredScrollableViewportSize(Dimension(800,240))
		scrl_rf_power_panel = JScrollPane(self.rf_power_table)
		scrl_rf_power_panel.setBorder(BorderFactory.createTitledBorder(etched_border,"RF Net Power"))
		self.init_buttons_panel = Init_RF_Power_Controller_Panel(self)
		self.start_stop_panel = Start_Stop_Panel(self)
		tmp0_panel = JPanel(BorderLayout())
		tmp0_panel.add(self.init_buttons_panel,BorderLayout.NORTH)
		tmp0_panel.add(scrl_rf_power_panel,BorderLayout.CENTER)
		tmp0_panel.add(self.start_stop_panel,BorderLayout.SOUTH)
		tmp1_panel = JPanel(BorderLayout())
		tmp1_panel.add(tmp0_panel,BorderLayout.NORTH)
		left_panel.add(tmp1_panel,BorderLayout.WEST)
		#--------------------------------------------------------
		self.main_panel.add(left_panel,BorderLayout.WEST)
		#---- non GUI controllers
		self.loop_run_state = Loop_Run_State()
		
	def getMainPanel(self):
		return self.main_panel
		
	def getMessageTextField(self):
		return self.top_document.getMessageTextField()	
		
	def writeDataToXML(self,root_da):
		rf_power_cntrl_da = root_da.createChild("RF_NET_POWER")			
			
	def readDataFromXML(self,root_da):		
		rf_power_cntrl_da = root_da.childAdaptor("MAIN_CONTROLLER")
开发者ID:kritha,项目名称:MyOpenXal,代码行数:43,代码来源:rf_net_power_cotroller_lib.py

示例4: __init__

# 需要导入模块: from javax.swing import JTable [as 别名]
# 或者: from javax.swing.JTable import setPreferredScrollableViewportSize [as 别名]
class Transverse_Twiss_Fitting_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()
		#-------------------------------------------------------------		
		self.initial_twiss_params_holder = Twiss_Params_Holder()
		self.initTwiss_table = JTable(Init_Twiss_Table_Model(self.initial_twiss_params_holder))
		self.initTwiss_table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION)
		self.initTwiss_table.setFillsViewportHeight(true)
		self.initTwiss_table.setPreferredScrollableViewportSize(Dimension(240,160))
		initTwiss_panel = JPanel(BorderLayout())
		initTwiss_panel.add(JScrollPane(self.initTwiss_table), BorderLayout.CENTER)
		initTwiss_knobs_panel = JPanel(FlowLayout(FlowLayout.CENTER,5,5))
		initTwiss_button = JButton("Init Twiss from Design")
		initTwiss_button.addActionListener(Init_Twiss_Button_Listener(self))
		initTwiss_knobs_panel.add(initTwiss_button)
		initTwiss_panel.add(initTwiss_knobs_panel, BorderLayout.SOUTH)
		border = BorderFactory.createTitledBorder(etched_border,"Initial Twiss Parameters")
		initTwiss_panel.setBorder(border)			
		#--------Init_and_Fit_Params_Controller panel ----------
		self.init_and_fit_params_controller = Init_and_Fit_Params_Controller(self.linac_wizard_document,self)
		#Twiss fitter is defined in the transverse_twiss_fitter_lib.py 
		self.twiss_fitter = null
		#----add panels to the main
		tmp_panel = JPanel(BorderLayout())
		tmp_panel.add(initTwiss_panel, BorderLayout.WEST)
		tmp_panel.add(self.init_and_fit_params_controller.getMainPanel(),BorderLayout.EAST)
		self.main_panel.add(tmp_panel, BorderLayout.WEST)
		
	def getMainPanel(self):
		return self.main_panel		
开发者ID:kritha,项目名称:MyOpenXal,代码行数:38,代码来源:transverse_twiss_analysis_subpanel_cntrl_lib.py

示例5: __init__

# 需要导入模块: from javax.swing import JTable [as 别名]
# 或者: from javax.swing.JTable import setPreferredScrollableViewportSize [as 别名]

#.........这里部分代码省略.........
		self.cav_controllers[9].cav_bpms_controller.pasta_bpm_0_index = 3
		self.cav_controllers[9].cav_bpms_controller.pasta_bpm_1_index = 5
		self.cav_controllers[10].cav_bpms_controller.pasta_bpm_0_index = 5
		self.cav_controllers[10].cav_bpms_controller.pasta_bpm_1_index = 6
		self.cav_controllers[11].cav_bpms_controller.pasta_bpm_0_index = 2
		self.cav_controllers[11].cav_bpms_controller.pasta_bpm_1_index = 3
		self.cav_controllers[12].cav_bpms_controller.pasta_bpm_0_index = 2
		self.cav_controllers[12].cav_bpms_controller.pasta_bpm_1_index = 4
		self.cav_controllers[13].cav_bpms_controller.pasta_bpm_0_index = 3
		self.cav_controllers[13].cav_bpms_controller.pasta_bpm_1_index = 4
		self.cav_controllers[11].cav_bpms_controller.sin_wave_bpm_index = 0
		self.cav_controllers[12].cav_bpms_controller.sin_wave_bpm_index = 0
		self.cav_controllers[13].cav_bpms_controller.sin_wave_bpm_index = 1
		#-----Target power levels
		self.cav_controllers[4].cav_wrapper.net_pwr_goal =  378.0
		self.cav_controllers[5].cav_wrapper.net_pwr_goal = 1208.0
		self.cav_controllers[6].cav_wrapper.net_pwr_goal = 1294.0
		self.cav_controllers[7].cav_wrapper.net_pwr_goal = 1416.0
		self.cav_controllers[8].cav_wrapper.net_pwr_goal = 1454.0
		self.cav_controllers[9].cav_wrapper.net_pwr_goal = 1414.0
		self.cav_controllers[10].cav_wrapper.net_pwr_goal = 2531.0
		self.cav_controllers[11].cav_wrapper.net_pwr_goal = 2984.0
		self.cav_controllers[12].cav_wrapper.net_pwr_goal = 3018.0
		self.cav_controllers[13].cav_wrapper.net_pwr_goal = 2856.0
		#----------------------------------------------   
		left_panel = JPanel(BorderLayout())
		self.tabbedPane = JTabbedPane()		
		self.tabbedPane.add("Cavity",JPanel(BorderLayout()))	
		self.tabbedPane.add("Parameters",JPanel(BorderLayout()))
		#--------------------------------------------------------
		self.cav_table = JTable(Cavities_Table_Model(self))
		self.cav_table.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION)
		self.cav_table.setFillsViewportHeight(true)
		self.cav_table.setPreferredScrollableViewportSize(Dimension(500,240))
		self.cav_table.getSelectionModel().addListSelectionListener(Cavs_Table_Selection_Listener(self))
		scrl_cav_panel = JScrollPane(self.cav_table)
		scrl_cav_panel.setBorder(BorderFactory.createTitledBorder(etched_border,"Cavities' Parameters"))
		init_buttons_panel = Init_Cav_Controllers_Panel(self)
		start_stop_panel = Start_Stop_Panel(self)
		#---- fake scan button
		self.keepAllCavParams_RadioButton = start_stop_panel.keepAllCavParams_RadioButton
		self.keepAmps_RadioButton = start_stop_panel.keepAmps_RadioButton
		#---- status text field
		self.status_text = start_stop_panel.status_text
		tmp0_panel = JPanel(BorderLayout())
		tmp0_panel.add(init_buttons_panel,BorderLayout.NORTH)
		tmp0_panel.add(scrl_cav_panel,BorderLayout.CENTER)
		tmp0_panel.add(start_stop_panel,BorderLayout.SOUTH)
		tmp1_panel = JPanel(BorderLayout())
		tmp1_panel.add(tmp0_panel,BorderLayout.NORTH)
		left_panel.add(tmp1_panel,BorderLayout.WEST)
		#--------------------------------------------------------
		self.main_panel.add(left_panel,BorderLayout.WEST)
		self.main_panel.add(self.tabbedPane,BorderLayout.CENTER)
		#---- non GUI controllers
		self.particle_tracker_model = Particle_Tracker_Model(self)
		self.env_tracker_model = Envelop_Tracker_Model(self)
		
	def getMainPanel(self):
		return self.main_panel
		
	def getMessageTextField(self):
		return self.top_document.getMessageTextField()
		
	def writeDataToXML(self,root_da):
		main_loop_cntrl_da = root_da.createChild("MAIN_CONTROLLER")
开发者ID:kritha,项目名称:MyOpenXal,代码行数:70,代码来源:main_loop_controller_lib.py

示例6: SessionRequestTab

# 需要导入模块: from javax.swing import JTable [as 别名]
# 或者: from javax.swing.JTable import setPreferredScrollableViewportSize [as 别名]

#.........这里部分代码省略.........
                action = str(table_model.getValueAt(r, 1))
                name = table_model.getValueAt(r, 2)
                value = table_model.getValueAt(r, 3)

                if type != None and name != None and value != None:
                    param = Parameter(type, action, name, self._extender.helpers.urlDecode(value))
                    session.modify(param)


            # Check if there is an empty last row 
            has_empty_row = True
            for i in range(2, 4):
                val = table_model.getValueAt(table_model.getRowCount() - 1, i)
                if val != None and val != "":
                    has_empty_row = False
                    break

            # no empty last row, add one
            if not has_empty_row:
                table_model.addRow(["", Parameter.ACTION_MODIFY, "", ""])

            # update message editor
            self.parse_message()

    def parse_message(self):
        self._editor.setText(self._extender.process_request(self._extender.HTTP))

    def getTabCaption(self):
        return "Session"

    def getUiComponent(self):
        return self._panel

    def isEnabled(self, content, isRequest):
        return isRequest 

    def setMessage(self, content, isRequest):
        self._extender.HTTP = self._extender.helpers.bytesToString(content)
        self._editor.setText(content)
        self.refresh_sessions()
        self.update_table()


    def getMessage(self):
        return self._editor.getText()

    def isModified(self):
        return self._editor.isTextModified()

    def getSelectedData(self):
        return self._editor.getSelectedText()

    @attach_stack_trace
    def __init__(self, extender, controller, editable):
        self._extender = extender

        self._panel = JPanel()  # main panel

        # type combobox for tables
        self._types = Parameter.type_mapping.values() + ["- Remove Row -"]
        self._actions = ["replace", "insert", "delete"]

        # define the GridBagLayout ( 4x4 )
        gridBagLayout = GridBagLayout()
        gridBagLayout.columnWidths = [ 0, 0, 0, 0]
        gridBagLayout.rowHeights = [0, 0, 0, 0]
        gridBagLayout.columnWeights = [1.0, 0.0, 0.0, 0.0]
        gridBagLayout.rowWeights = [0.0, 1.0, 5.0, 0.0]
        self._panel.setLayout(gridBagLayout)

        # JComboBox for Session selection
        self._session_selector = JComboBox(extender.sm.sessions, itemStateChanged=self.changeSession)
        self._session_selector_model = self._session_selector.getModel()
        gbc_session_selector = _new_grid_bag(0, 0)
        self._panel.add(self._session_selector, gbc_session_selector)


        # "Delete Session" Button
        del_session = JButton("Delete Session", actionPerformed=self.deleteSession)
        gbc_del_session = _new_grid_bag(1, 0)
        self._panel.add(del_session, gbc_del_session)

        # "New Session" Button
        new_session = JButton("New Session", actionPerformed=self.new_session)
        gbc_new_session = _new_grid_bag(2, 0)
        self._panel.add(new_session, gbc_new_session)

        # Table containing modified parameters
        self.modification_table = JTable()
        self.update_table()

        gbc_modification_table = _new_grid_bag(0, 1, 3)
        self._panel.add(JScrollPane(self.modification_table), gbc_modification_table)
        self.modification_table.setPreferredScrollableViewportSize(self.modification_table.getPreferredSize());
        self.modification_table.setFillsViewportHeight(True)

        # HTTP message editor
        self._editor = self._extender.callbacks.createTextEditor()
        gbc_messageEditor = _new_grid_bag(0, 2, 3)
        self._panel.add(self._editor.getComponent(), gbc_messageEditor)
开发者ID:eboda,项目名称:burp-sessions,代码行数:104,代码来源:ui.py

示例7: __init__

# 需要导入模块: from javax.swing import JTable [as 别名]
# 或者: from javax.swing.JTable import setPreferredScrollableViewportSize [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.setPreferredScrollableViewportSize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。