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


Python JTable.getColumnModel方法代码示例

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


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

示例1: _initializeGui

# 需要导入模块: from javax.swing import JTable [as 别名]
# 或者: from javax.swing.JTable import getColumnModel [as 别名]
    def _initializeGui(self, callbacks):
        tab = JPanel()

        jLabel1 = JLabel("Original Hash:")
        jLabel2 = JLabel("Original message:")
        jLabel3 = JLabel("Message to append:")
        jLabel5 = JLabel("Max key length:")
        jTextField1 = JTextField("")
        jTextField2 = JTextField("")
        jTextField3 = JTextField("")
        jTextField4 = JTextField("128")
        jLabel4 = JLabel("Hashing functions")
        jCheckBox1 = JCheckBox("MD4")
        jCheckBox2 = JCheckBox("MD5")
        jCheckBox3 = JCheckBox("SHA1")
        jCheckBox4 = JCheckBox("SHA256")
        jCheckBox5 = JCheckBox("SHA512")
        jCheckBox1.setEnabled(False)
        jCheckBox2.setEnabled(False)
        jCheckBox3.setEnabled(False)
        jCheckBox4.setEnabled(False)
        jCheckBox5.setEnabled(False)
        jScrollPane1 = JScrollPane()
        jTable1 = JTable()
        jButton1 = JButton("Generate", actionPerformed=self.generate_attack)
        jButton1.setEnabled(False)
        jButton2 = JButton("Copy messages", actionPerformed=self.copy_messages)
        jButton3 = JButton("Copy hashes", actionPerformed=self.copy_hashes)

        self._tab = tab
        self._textfields = {
            "original_hash": jTextField1,
            "original_msg": jTextField2,
            "append_msg": jTextField3,
            "max_key_len": jTextField4,
        }
        self._checkboxes = {
            md4: jCheckBox1,
            md5: jCheckBox2,
            sha1: jCheckBox3,
            sha256: jCheckBox4,
            sha512: jCheckBox5,
        }

        self._table = jTable1
        self._extensions = {}
        self._hashes, self._messages = [], []

        # Hash field change event
        jTextField1.getDocument().addDocumentListener(HashChangeListener(self._checkboxes, self._textfields['original_hash'], jButton1))

        # Table columns
        jTable1.setModel(DefaultTableModel([],["#", "Type","New Message", "Hash"]))
        jScrollPane1.setViewportView(jTable1)
        # Table column width
        jTable1.getColumnModel().getColumn(0).setMaxWidth(50)
        jTable1.getColumnModel().getColumn(1).setMaxWidth(60)

        layout = GroupLayout(tab)
        tab.setLayout(layout)

        layout.setHorizontalGroup(
            layout.createParallelGroup(GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(24, 24, 24)
                .addGroup(layout.createParallelGroup(GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel5)
                    .addComponent(jLabel1)
                    .addComponent(jLabel2)
                    .addComponent(jLabel3))
                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                    .addComponent(jTextField3, GroupLayout.DEFAULT_SIZE, 425, 32767)
                    .addComponent(jTextField2)
                    .addComponent(jTextField1)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jTextField4, GroupLayout.PREFERRED_SIZE, 88, GroupLayout.PREFERRED_SIZE)
                        .addGap(0, 0, 32767)))
                .addGap(30, 30, 30)
                .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jCheckBox1)
                        .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jCheckBox2)
                        .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jCheckBox3)
                        .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jCheckBox4)
                        .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jCheckBox5))
                    .addComponent(jLabel4)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jButton1)
                        .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jButton3)
                        .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jButton2)))
                .addGap(167, 167, 167))
            .addComponent(jScrollPane1)
        )
#.........这里部分代码省略.........
开发者ID:vergl4s,项目名称:signatures,代码行数:103,代码来源:signatures.py

示例2: __init__

# 需要导入模块: from javax.swing import JTable [as 别名]
# 或者: from javax.swing.JTable import getColumnModel [as 别名]
class Transverse_Twiss_Analysis_Controller:
	def __init__(self,linac_wizard_document):
		#--- linac_wizard_document the parent document for all controllers
		self.linac_wizard_document = linac_wizard_document
		#----		fit_param_index = 0,1,2 gauss, custom gauss, custom rms
		self.fit_param_index = 0
		#--------------------------------------------------------------
		self.accStatesKeeper = AccStatesKeeper(self.linac_wizard_document)
		self.main_panel = JPanel(BorderLayout())
		#----etched border
		etched_border = BorderFactory.createEtchedBorder()		
		#---------hor. ver. graph panels
		self.graphs_panel = Graphs_Panel(self)
		#---------quads' and cavities' parameters tables panels
		self.quad_cav_params_tables_panel = Quad_and_Cav_Params_Table_Panel(self)
		#-------- tabbed panel with graphs and tables
		self.graphs_and_tables_tabbed_panel = JTabbedPane()
		self.graphs_and_tables_tabbed_panel.add("Hor. Ver. Long. Plots",self.graphs_panel)
		self.graphs_and_tables_tabbed_panel.add("Cavities and Quads Tables",self.quad_cav_params_tables_panel)
		#------ sets selection table
		self.dict_panel = QuadCavDictSelection_Panel(self)		
		#---------H and V Size Tables
		hor_size_table_border = BorderFactory.createTitledBorder(etched_border,"Horizontal")
		ver_size_table_border = BorderFactory.createTitledBorder(etched_border,"Vertical")
		self.hor_size_table_model = Tr_Size_Table_Model(WS_DIRECTION_HOR,self)
		self.hor_size_table = JTable(self.hor_size_table_model)
		self.hor_size_table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION)
		self.hor_size_table.setFillsViewportHeight(true)	
		hor_size_panel = JPanel(BorderLayout())
		hor_size_panel.setBorder(hor_size_table_border)
		hor_size_panel.add(JScrollPane(self.hor_size_table), BorderLayout.CENTER)
		self.ver_size_table_model = Tr_Size_Table_Model(WS_DIRECTION_VER,self)
		self.ver_size_table = JTable(self.ver_size_table_model)
		self.ver_size_table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION)
		self.ver_size_table.setFillsViewportHeight(true)	
		ver_size_panel = JPanel(BorderLayout())
		ver_size_panel.setBorder(ver_size_table_border)
		ver_size_panel.add(JScrollPane(self.ver_size_table), BorderLayout.CENTER)
		sizes_table_panel = JPanel(GridLayout(3,1))
		#-----------column sizes ---------
		columnModel = self.hor_size_table.getColumnModel()
		columnModel.getColumn(0).setPreferredWidth(30)
		columnModel.getColumn(1).setPreferredWidth(120)
		columnModel.getColumn(2).setPreferredWidth(60)
		columnModel.getColumn(3).setPreferredWidth(30)
		columnModel.getColumn(4).setPreferredWidth(50)
		columnModel.getColumn(5).setPreferredWidth(50)
		columnModel.getColumn(6).setPreferredWidth(50)	
		columnModel = self.ver_size_table.getColumnModel()
		columnModel.getColumn(0).setPreferredWidth(30)
		columnModel.getColumn(1).setPreferredWidth(120)
		columnModel.getColumn(2).setPreferredWidth(60)
		columnModel.getColumn(3).setPreferredWidth(30)
		columnModel.getColumn(4).setPreferredWidth(50)
		columnModel.getColumn(5).setPreferredWidth(50)
		columnModel.getColumn(6).setPreferredWidth(50)
		sizes_table_panel.add(self.dict_panel.getMainPanel())
		sizes_table_panel.add(hor_size_panel)
		sizes_table_panel.add(ver_size_panel)
		#---------Transverse Fitting Controller
		self.transverse_twiss_fitting_controller = Transverse_Twiss_Fitting_Controller(self.linac_wizard_document)
		#----add panels to the main
		self.main_panel.add(self.graphs_and_tables_tabbed_panel, BorderLayout.CENTER)
		self.main_panel.add(sizes_table_panel, BorderLayout.WEST)
		self.main_panel.add(self.transverse_twiss_fitting_controller.getMainPanel(), BorderLayout.SOUTH)
		
	def getMainPanel(self):
		return self.main_panel		
		
	def makeWS_LW_Size_Record(self):
		return WS_LW_Size_Record()
开发者ID:kritha,项目名称:MyOpenXal,代码行数:73,代码来源:transverse_twiss_analysis_cntrl_lib.py

示例3: __init__

# 需要导入模块: from javax.swing import JTable [as 别名]
# 或者: from javax.swing.JTable import getColumnModel [as 别名]
class WS_Data_Analysis_Controller:
	""" 
	This controller manages the WS data analysis. 
	Its panel is in the WS_LW_Acquisition_Controller panel. 
	"""
	def __init__(self,ws_lw_acquisition_controller):
		self.ws_lw_acquisition_controller = ws_lw_acquisition_controller
		self.local_gauss_fitter = Local_Gauss_Fitter()
		self.main_panel = JPanel(BorderLayout())
		self.ws_records_table_model = WS_Records_Table_Model()
		#----etched border
		etched_border = BorderFactory.createEtchedBorder()
		#---make the WS_Records_JTable + Graph Panel
		self.records_table = JTable(self.ws_records_table_model)
		self.records_table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION)
		self.records_table.setFillsViewportHeight(true)
		#----set up records_table columns width
		columnModel = self.records_table.getColumnModel()
		columnModel.getColumn(0).setPreferredWidth(30)
		columnModel.getColumn(1).setPreferredWidth(160)
		columnModel.getColumn(2).setPreferredWidth(40)
		columnModel.getColumn(3).setPreferredWidth(40)
		columnModel.getColumn(4).setPreferredWidth(80)
		columnModel.getColumn(5).setPreferredWidth(70)
		columnModel.getColumn(6).setPreferredWidth(70)
		#---------------------------------------------------
		records_panel = JPanel(BorderLayout())
		records_panel.add(JScrollPane(self.records_table), BorderLayout.CENTER)
		knobs_gauss_panel = JPanel(BorderLayout())
		records_panel.add(knobs_gauss_panel, BorderLayout.SOUTH)
		records_panel.setBorder(etched_border)
		#---records knobs ---------------------------------------------
		records_knobs_panel = JPanel(FlowLayout(FlowLayout.CENTER,5,5))
		guess_and_fit_button = JButton("Guess and Fit")
		analysis_all_button = JButton("G&F All")		
		fit_button = JButton("Fit")
		fit_all_button = JButton("Fit All")
		send_to_twiss_button = JButton("Send to Twiss Analysis")
		records_knobs_panel.add(guess_and_fit_button)
		records_knobs_panel.add(analysis_all_button)		
		records_knobs_panel.add(fit_button)
		records_knobs_panel.add(fit_all_button)
		records_knobs_panel.add(send_to_twiss_button)
		guess_and_fit_button.addActionListener(Guess_And_Fit_Listener(self.ws_lw_acquisition_controller))
		fit_button.addActionListener(Fit_Listener(self.ws_lw_acquisition_controller))
		fit_all_button.addActionListener(Fit_All_Listener(self.ws_lw_acquisition_controller))
		analysis_all_button.addActionListener(Guess_And_Fit_All_Listener(self.ws_lw_acquisition_controller))
		send_to_twiss_button.addActionListener(SendToAnalysis_Listener(self.ws_lw_acquisition_controller))
		self.gauss_fit_param_panel = GaussFitDataPanel()
		knobs_gauss_panel.add(records_knobs_panel, BorderLayout.NORTH)
		knobs_gauss_panel.add(self.gauss_fit_param_panel, BorderLayout.SOUTH)
		#---------------------------------------------------------
		self.record_analysis_panel = JPanel(BorderLayout())
		border = BorderFactory.createTitledBorder(etched_border,"WS/LW Wave Form Analysis")
		self.record_analysis_panel.setBorder(border)
		self.record_analysis_panel.add(records_panel, BorderLayout.WEST)
		self.gpanel_WF = FunctionGraphsJPanel()
		self.gpanel_WF.setLegendButtonVisible(true)
		self.gpanel_WF.setChooseModeButtonVisible(true)			
		self.gpanel_WF.setName("Profile")
		self.gpanel_WF.setAxisNames("pos, [mm]","Amp, [arb. units]")	
		self.gpanel_WF.setBorder(etched_border)
		self.gpanel_WF.addVerticalLine(-1.0e+30,Color.red)
		self.gpanel_WF.addVerticalLine(+1.0e+30,Color.red)
		self.gpanel_WF.setVerLinesButtonVisible(true)
		self.gpanel_WF.addDraggedVerLinesListener(Position_Limits_Listener(self.ws_lw_acquisition_controller))
		self.record_analysis_panel.add(self.gpanel_WF, BorderLayout.CENTER)
		self.main_panel.add(self.record_analysis_panel, BorderLayout.CENTER)
		#---set up Listeners 
		self.records_table.getSelectionModel().addListSelectionListener(WS_Record_Table_Selection_Listener(self.ws_lw_acquisition_controller))

	def setDataToGraphPanel(self,ws_record):
		self.gpanel_WF.removeAllGraphData()
		self.gpanel_WF.addGraphData(ws_record.gd_wf)
		self.gpanel_WF.addGraphData(ws_record.gd_fit_wf)
开发者ID:kritha,项目名称:MyOpenXal,代码行数:77,代码来源:ws_lw_acquisition_cntrl_lib.py

示例4: QatDialog

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

#.........这里部分代码省略.........
        else:
            self.statsPanel.background = colors[color]
            self.checksTextFld.foreground = colors["white"]

    def change_selection(self, source):
        """Change comboboxes and checks table selections after a
           selection has been made by the user
        """
        if source in ("menu", "layer", "add favourite"):
            self.app.selectionChangedFromMenuOrLayer = True
            self.toolsCombo.setSelectedItem(self.app.selectedTool)
            self.viewsCombo.setModel(self.app.selectedTool.viewsComboModel)
            self.viewsCombo.setSelectedItem(self.app.selectedView.title)

            self.checksTable.setModel(self.app.selectedTableModel)
            self.refresh_checksTable_columns_geometries()
            for i, c in enumerate(self.app.selectedView.checks):
                if c == self.app.selectedChecks[0]:
                    break
            self.checksTable.setRowSelectionInterval(i, i)
            self.app.selectionChangedFromMenuOrLayer = False
        else:
            self.app.selectionChangedFromMenuOrLayer = False
            if source == "toolsCombo":
                self.viewsCombo.setModel(self.app.selectedTool.viewsComboModel)
                self.viewsCombo.setSelectedIndex(0)
            elif source == "viewsCombo":
                self.checksTable.setModel(self.app.selectedTableModel)
                self.refresh_checksTable_columns_geometries()
                if self.app.selectedView.checks != []:  # favourite checks may be none
                    self.checksTable.setRowSelectionInterval(0, 0)

    def refresh_checksTable_columns_geometries(self):
        self.checksTable.getColumnModel().getColumn(0).setCellRenderer(self.iconrenderer)
        self.checksTable.getColumnModel().getColumn(0).setMaxWidth(25)
        self.checksTable.getColumnModel().getColumn(2).setMaxWidth(60)

    def activate_error_tab(self, status):
        if status:
            if self.tabbedPane.getTabCount() == 1:
                self.tabbedPane.addTab(self.app.strings.getString("Fix"),
                                       None,
                                       self.panel2,
                                       self.app.strings.getString("fix_tab"))
        else:
            if self.tabbedPane.getTabCount() == 2:
                self.tabbedPane.remove(1)

    def update_checks_buttons(self):
        """This method sets the status of downloadBtn and startBtn
        """
        #none check selected
        if len(self.app.selectedChecks) == 0:
            self.downloadBtn.setEnabled(False)
            self.startBtn.setEnabled(False)
        else:
            #some check selected
            self.downloadBtn.setEnabled(True)
            if len(self.app.selectedChecks) > 1:
                self.startBtn.setEnabled(False)
            else:
                #only one check is selected
                self.app.errors = self.app.selectedChecks[0].errors
                if self.app.errors is None or len(self.app.errors) == 0:
                    #errors file has not been downloaded and parsed yet
                    self.startBtn.setEnabled(False)
开发者ID:floscher,项目名称:qat_script,代码行数:70,代码来源:QatDialog.py

示例5: PreferencesFrame

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

#.........这里部分代码省略.........

        #max errors number
        self.maxErrorsNumberTextField.setText(str(self.app.maxErrorsNumber))

        #stats panel
        self.app.dlg.update_favourite_zone_indicator()

        #2 Tab
        #favourite area
        self.update_favourite_area_gui_from_preferences()
        self.app.dlg.update_statsPanel_status()

        #3 Tab
        #tools preferences
        for tool in self.app.allTools:
            if hasattr(tool, 'prefs') and tool.prefsGui is not None:
                tool.prefsGui.update_gui(tool.prefs)

    def update_favourite_area_gui_from_preferences(self):
        #status
        self.favZoneStatusCBtn.setSelected(self.app.favouriteZoneStatus)
        #table
        #store zones to a temporary list, used to store changes
        #and save them when preferences dialog is closed
        self.app.tempZones = list(self.app.zones)
        self.zonesTable.getModel().setNumRows(0)
        for zone in self.app.tempZones:
            self.zonesTable.getModel().addRow([zone.country,
                                               zone.icon,
                                               zone.name])
        if self.app.favZone is not None:
            selectedRow = self.app.tempZones.index(self.app.favZone)
            self.zonesTable.setRowSelectionInterval(selectedRow, selectedRow)
        self.zonesTable.getColumnModel().getColumn(0).setMaxWidth(30)
        self.zonesTable.getColumnModel().getColumn(1).setMaxWidth(50)
        #enable or disable favourite zone buttons
        self.actionPerformed()

### fav area editing buttons ###########################################
    def on_removeBtn_clicked(self, e):
        rowsNum = self.zonesTable.getSelectedRows()
        rowsNum.reverse()
        for rowNum in rowsNum:
            del self.app.tempZones[rowNum]
            self.zonesTable.getModel().removeRow(rowNum)
        if len(self.app.tempZones) != 0:
            if rowNum == 0:
                self.zonesTable.setRowSelectionInterval(0, 0)
            else:
                self.zonesTable.setRowSelectionInterval(rowNum - 1, rowNum - 1)
        self.check_removeBtn_status()

    def check_removeBtn_status(self):
        if self.app.tempZones != [] and len(self.zonesTable.getSelectedRows()) != 0:
            self.removeBtn.setEnabled(True)
        else:
            self.removeBtn.setEnabled(False)
            self.clean_map()

    def on_newBtn_clicked(self, e):
        try:
            self.newZoneDialog
        except AttributeError:
            self.newZoneDialog = NewZoneDialog(self.app)
        bbox = self.app.get_frame_bounds()
        self.app.newZone = Zone(self.app,
开发者ID:floscher,项目名称:qat_script,代码行数:70,代码来源:PreferencesFrame.py

示例6: SessionFromRequestDialog

# 需要导入模块: from javax.swing import JTable [as 别名]
# 或者: from javax.swing.JTable import getColumnModel [as 别名]
class SessionFromRequestDialog(JDialog):
    def should_use(self, name):
        """Suggests if parameter with provided name should be used"""

        suggestions = ["session",  "authenticity", "csrf", "xsrf"]
        name = name.lower()
        return any(map(lambda x: x in name, suggestions))

    def save(self, evt):
        model = self.table.getModel()
        session = self._parent._extender.sm.selected_session
        session.reset()
        for r in range(model.getRowCount()):
            use = bool(model.getValueAt(r, 0))
            type = str(model.getValueAt(r, 1))
            name = model.getValueAt(r, 2)
            value = model.getValueAt(r, 3)

            if use:
                param = Parameter(type, Parameter.ACTION_MODIFY, name, self._parent._extender.helpers.urlDecode(value))
                session.modify(param)
        self.setVisible(False)
        self.dispose()
        self._parent.refresh_sessions()
        self._parent.update_table()



    @attach_stack_trace
    def __init__(self, parent):
        self._parent = parent
        self.setTitle("Select Parameters/Headers for new Session")

        print "IN DIALOG!Q!!"

        self.table = JTable()

        columns = ["Use", "Type", "Name", "Value"]
        data = []

        headers = self._parent._extender.headers
        parameters = self._parent._extender.parameters

        for header in headers[1:]:
            name, val = header.split(": ")
            data.append([self.should_use(name), "Header", name, val])

        for param in parameters:
            data.append([self.should_use(param.getName()), Parameter.type_mapping[param.getType()], param.getName(), param.getValue()])

        class CheckBoxTableModel(DefaultTableModel):
            def getColumnClass(self, x):
                if x == 0:
                    return Boolean
                else:
                    return String

        data_model = CheckBoxTableModel(data, columns)
        self.table.setModel(data_model)
        self.table.getColumnModel().getColumn(0).setMaxWidth(30)
        self.table.getColumnModel().getColumn(1).setMaxWidth(50)


        gridBagLayout = GridBagLayout()
        gridBagLayout.columnWidths = [ 0, 0, 0]
        gridBagLayout.rowHeights = [0, 0, 0]
        gridBagLayout.columnWeights = [0.0, 0.0, 0.0]
        gridBagLayout.rowWeights = [0.0, 1.0, 0.0]
        self.setLayout(gridBagLayout)

        self.getContentPane().add(JLabel("Select Parameters/Headers for new session:"), _new_grid_bag(0, 0, 3))
        self.getContentPane().add(JScrollPane(self.table), _new_grid_bag(0, 1, 3))
        self.getContentPane().add(JButton("Save", actionPerformed=self.save), _new_grid_bag(1, 2))

        self.pack()
        self.setVisible(True)
开发者ID:eboda,项目名称:burp-sessions,代码行数:78,代码来源:ui.py


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