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


Python JComboBox.setEditable方法代码示例

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


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

示例1: addLine

# 需要导入模块: from javax.swing import JComboBox [as 别名]
# 或者: from javax.swing.JComboBox import setEditable [as 别名]
    def addLine(self, objectID, category, text):
        """
        Add a new panel containing the text corresponding to one line in the
        ATF file.
        This panel will show the line type (ruling, comment, text,
        translation...), followed by the line content and a group of icons to
        add, edit or remove the line.
        """
        linePanel = JPanel()
        linePanel.setLayout(BorderLayout())

        label = JLabel(category)

        combo = JComboBox(text)
        combo.setEditable(True)
        combo.setPreferredSize(Dimension(500, 20))
        combo.setSize(combo.getPreferredSize())
        combo.setMinimumSize(combo.getPreferredSize())
        combo.setMaximumSize(combo.getPreferredSize())

        buttonsPanel = JPanel()
        addButton = JButton("Add")
        editButton = JButton("Edit")
        deleteButton = JButton("Delete")
        buttonsPanel.add(addButton)
        buttonsPanel.add(editButton)
        buttonsPanel.add(deleteButton)

        linePanel.add(label, BorderLayout.WEST)
        linePanel.add(combo, BorderLayout.CENTER)
        linePanel.add(buttonsPanel, BorderLayout.EAST)

        # Add metadataPanel to object tab in main panel
        self.objectTabs[objectID].add(linePanel)
开发者ID:oracc,项目名称:nammu,代码行数:36,代码来源:ModelView.py

示例2: gui

# 需要导入模块: from javax.swing import JComboBox [as 别名]
# 或者: from javax.swing.JComboBox import setEditable [as 别名]
 def gui(self):
   file_field = JTextField(self.dsm2file,15)
   load_btn = JButton('Load input   ')
   chan_box = JComboBox()
   chan_box.setEditable(1)
   do_btn = JButton('Plot channel')
   choices = [JRadioButton('XSection'),
              JRadioButton('Area'),
              JRadioButton('Width'),
              JRadioButton('Perimeter'),
              JRadioButton('Rh'),
              JRadioButton('Xc'),
              JRadioButton('Zc')]
   #bg = ButtonGroup()
   #for choice in choices: bg.add(choice)
   class load_listener(ActionListener):
     def __init__(self,file_field,load_btn,
                  chan_box,do_btn,
                  choices):
       self.file_field = file_field
       self.load_btn = load_btn
       self.chan_box = chan_box
       self.do_btn = do_btn
       self.do_btn.setEnabled(0)
       self.load_btn.addActionListener(self)
       self.do_btn.addActionListener(self)
       self.choices=choices
     def actionPerformed(self,evt):
       if evt.getSource() == self.load_btn :
         self.ig = IrregGeom(self.file_field.getText())
         import javax.swing
         md = javax.swing.DefaultComboBoxModel(self.ig.getChanList())
         self.chan_box.setModel(md)
         self.do_btn.setEnabled(1)
       elif evt.getSource() == self.do_btn :
         if self.ig:
           for choice in self.choices:
             if choice.isSelected():
               self.ig.plot(self.chan_box.getSelectedItem(),choice.getText())
   ll = load_listener(file_field, load_btn, chan_box, do_btn,choices)
   p1 = JPanel()
   p1.setLayout(BorderLayout())
   p1.add(file_field,BorderLayout.CENTER)
   p1.add(load_btn,BorderLayout.EAST)
   p2 = JPanel()
   p2.setLayout(BorderLayout())
   p2.add(chan_box,BorderLayout.CENTER)
   p2.add(do_btn,BorderLayout.EAST)
   p3 = JPanel()
   p3.setLayout(GridLayout(1,2))
   p3.add(choices[0]); p3.add(choices[1])
   p4 = JPanel()
   p4.setLayout(GridLayout(1,2))
   p4.add(choices[2]); p4.add(choices[3])
   p5 = JPanel()
   p5.setLayout(GridLayout(1,2))
   p5.add(choices[4]); p5.add(choices[5])
   p6 = JPanel()
   p6.setLayout(GridLayout(1,2))
   p6.add(choices[6])
   #
   mp = JPanel()
   mp.setLayout(GridLayout(6,1))
   mp.add(p1)
   mp.add(p2)
   mp.add(p3)
   mp.add(p4)
   mp.add(p5)
   mp.add(p6)
   return mp
开发者ID:GTP-CalLitGUI,项目名称:CalLiteGUI_RW1,代码行数:72,代码来源:dsm2.py

示例3: NewAtfView

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

#.........这里部分代码省略.........
                             help_label,
                             5,
                             SpringLayout.EAST,
                             self.right_field)
        layout.putConstraint(SpringLayout.NORTH,
                             help_label,
                             23,
                             SpringLayout.NORTH,
                             panel)
        layout.putConstraint(SpringLayout.EAST,
                             panel,
                             15,
                             SpringLayout.EAST,
                             help_label)
        layout.putConstraint(SpringLayout.SOUTH,
                             panel,
                             10,
                             SpringLayout.SOUTH,
                             help_label)
        # Add this to NewAtf JFrame
        return panel

    def build_projects_row(self):
        '''
        Builds the projects row.
        '''
        # Build own panel with SpringLayout.
        panel = JPanel()
        layout = SpringLayout()
        panel.setLayout(layout)
        # Create necessary components and add them to panel.
        project_label = JLabel('Project: ')
        self.right_combo = JComboBox()
        self.right_combo.setEditable(True)

        def create_project_list():
            '''
            Prepares list of projects and subprojects ordered with the default
            one first.
            '''
            default_project = self.projects['default'][0].split('/')[0]
            if '/' in self.projects['default']:
                default_subproject = self.projects['default'].split('/')[1]
            else:
                default_subproject = ''
            projects = [default_project]
            subprojects = [default_subproject]
            # User created projects might not be in default dictionary
            for project in self.projects.keys():
                if (project != default_project and project != 'default'):
                    projects.append(project)
                # Default project might not have subproject
            if default_project in self.projects.keys():
                if default_subproject:
                    for subproject in self.projects[default_project]:
                        if (subproject != default_subproject):
                            subprojects.append(subproject)
            return projects, subprojects

        self.left_combo = JComboBox(create_project_list()[0])
        # Make left combo keep size no matter how long project names are
        self.left_combo.setPreferredSize(Dimension(125, 30))
        self.left_combo.setMinimumSize(self.left_combo.getPreferredSize())
        self.left_combo.setMaximumSize(self.left_combo.getPreferredSize())
        self.left_combo.setSize(self.left_combo.getPreferredSize())
开发者ID:oracc,项目名称:nammu,代码行数:69,代码来源:NewAtfView.py


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