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


Python JComboBox.setSelectedIndex方法代码示例

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


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

示例1: PrefsPanel

# 需要导入模块: from javax.swing import JComboBox [as 别名]
# 或者: from javax.swing.JComboBox import setSelectedIndex [as 别名]
class PrefsPanel(JPanel):
    """JPanle with gui for tool preferences
    """
    def __init__(self, app):
        strings = app.strings

        self.setLayout(GridLayout(3, 2, 5, 5))
        userLbl = JLabel(strings.getString("osmose_pref_username"))
        self.userTextField = JTextField(20)
        self.userTextField.setToolTipText(strings.getString("osmose_pref_username_tooltip"))

        levelLbl = JLabel(strings.getString("osmose_pref_level"))
        self.levels = ["1", "1,2", "1,2,3", "2", "3"]
        self.levelsCombo = JComboBox(self.levels)
        self.levelsCombo.setToolTipText(strings.getString("osmose_pref_level_tooltip"))

        limitLbl = JLabel(strings.getString("osmose_pref_limit"))
        self.limitTextField = JTextField(20)
        self.limitTextField.setToolTipText(strings.getString("osmose_pref_limit_tooltip"))

        self.add(userLbl)
        self.add(self.userTextField)
        self.add(levelLbl)
        self.add(self.levelsCombo)
        self.add(limitLbl)
        self.add(self.limitTextField)

    def update_gui(self, preferences):
        """Update preferences gui
        """
        self.userTextField.setText(preferences["username"])
        self.levelsCombo.setSelectedIndex(self.levels.index(preferences["level"]))
        self.limitTextField.setText(str(preferences["limit"]))

    def read_gui(self):
        """Read preferences from gui
        """
        username = self.userTextField.getText()
        level = self.levelsCombo.getSelectedItem()
        limit = self.limitTextField.getText()
        try:
            limit = Integer.parseInt(limit)
            if limit > 500:
                limit = 500
            limit = str(limit)
        except NumberFormatException:
            limit = ""

        preferences = {"username": username.strip(),
                       "level": level,
                       "limit": limit}
        return preferences
开发者ID:alex85k,项目名称:qat_script,代码行数:54,代码来源:Osmose_prefs_gui.py

示例2: makeScriptComboBox

# 需要导入模块: from javax.swing import JComboBox [as 别名]
# 或者: from javax.swing.JComboBox import setSelectedIndex [as 别名]
def makeScriptComboBox(list):
    from javax.swing import JComboBox, JButton, JPanel
    from java.awt.event import ActionListener

    jcb = JComboBox(list)
    jcb.setSelectedIndex(0)
    plot_btn = JButton("Plot station")
    # create a Python class
    class PlotButtonAction(ActionListener):
        # defines a constructor
        def __init__(self, combo_box):
            self.cb = combo_box

        def actionPerformed(self, event):
            plotStation(self.cb.getSelectedIndex(), None)

    # registers an instance of the action object with the button
    plot_btn.addActionListener(PlotButtonAction(jcb))
    #
    alltw_btn = JButton("All Data")

    class AllButtonAction(ActionListener):
        # defines a constructor
        def __init__(self, combo_box):
            self.cb = combo_box

        def actionPerformed(self, event):
            plotStation(self.cb.getSelectedIndex(), 1)

    alltw_btn.addActionListener(AllButtonAction(jcb))
    #
    quit_btn = JButton("Quit")

    class QuitButtonAction(ActionListener):
        # defines a constructor
        def __init__(self, combo_box):
            self.cb = combo_box

        def actionPerformed(self, event):
            fr.dispose()

    quit_btn.addActionListener(QuitButtonAction(jcb))
    # add both button and combo box to a panel
    panel = JPanel()
    panel.setLayout(GridLayout(2, 2))
    panel.add(alltw_btn)
    panel.add(jcb)
    panel.add(plot_btn)
    panel.add(quit_btn)
    return panel
开发者ID:fluxdark,项目名称:dsm2-vista,代码行数:52,代码来源:stationGUIs.py

示例3: __init__

# 需要导入模块: from javax.swing import JComboBox [as 别名]
# 或者: from javax.swing.JComboBox import setSelectedIndex [as 别名]
 def __init__(self, chartFun, isTemporal = False):
     self.isTemporal = isTemporal
     JPanel()
     #self.setBackground(Color.LIGHT_GRAY)
     self.chartFun = chartFun
     self.enableChartFun = False
     self.setLayout(GridLayout(6,2))
     self.add(JLabel('CPU Cores'))
     cores = JComboBox(['1', '2', '4', '8', '16', '32', '64', '128'])
     nprocs = ManagementFactory.getOperatingSystemMXBean().getAvailableProcessors()
     pos = min([7, log(ceil(nprocs)) / log(2)])
     cores.setSelectedIndex(int(pos))
     cores.setMaximumSize(cores.getPreferredSize())
     self.cores = cores
     self.add(self.cores)
     self.add(JLabel('# of sims (x1000)  '))
     numSims = JComboBox(
         map(lambda x: str((10+x)*5), range(10)) +
         map(lambda x: str(x*100), range(1,11))
     )
     numSims.setMaximumSize(numSims.getPreferredSize())
     self.numSims = numSims
     self.add(self.numSims)
     if isTemporal:
         self.add(JLabel('"Neutral" Ne'))
         self.neutral = JCheckBox()
         self.neutral.addActionListener(self)
         self.add(self.neutral)
     else:
         self.add(JLabel('"Neutral" mean Fst'))
         self.neutral = JCheckBox()
         self.neutral.addActionListener(self)
         self.add(self.neutral)
         self.add(JLabel('Force mean Fst'))
         self.force = JCheckBox()
         self.force.addActionListener(self)
         self.add(self.force)
     self.add(JLabel('Confidence interval '))
     ci = JComboBox(['0.95', '0.99', '0.995'])
     ci.addItemListener(self)
     ci.setMaximumSize(cores.getPreferredSize())
     self.ci = ci
     self.add(self.ci)
     self.add(JLabel('False Disc. Rate'))
     fdr = JFormattedTextField(
         NumberFormat.getNumberInstance(Locale.US))
     fdr.setValue(0.1)
     fdr.addPropertyChangeListener(self)
     self.add(fdr)
     self.fdr = fdr
开发者ID:samitha,项目名称:lositan,代码行数:52,代码来源:SystemPanel.py

示例4: NewZoneDialog

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

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

        self.configPanel = JPanel(CardLayout())
        self.configPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5))
        self.configPanel.add(self.rectPanel, RECTPANEL)
        self.configPanel.add(self.polygonPanel, POLYGONPANEL)
        self.configPanel.add(self.boundaryPanel, BOUNDARYPANEL)
        self.configPanel.setAlignmentX(Component.LEFT_ALIGNMENT)
        self.add(self.configPanel)
        buttonsPanel = JPanel()
        buttonsPanel.add(self.okBtn)
        buttonsPanel.add(self.cancelBtn)
        buttonsPanel.add(self.previewBtn)
        buttonsPanel.setAlignmentX(Component.LEFT_ALIGNMENT)
        self.add(buttonsPanel)

        self.addWindowListener(self)
        self.pack()

    def update_gui_from_preferences(self):
        self.nameTextField.setText(self.app.newZone.name)
        #Reset rectangle mode
        bboxStr = ",".join(["%0.4f" % x for x in self.app.newZone.bbox])
        self.bboxTextField.setText(bboxStr)
        self.bboxPreviewTextField.setText(bboxStr)
        self.bboxFromJosmBtn.setEnabled(True)
        self.bboxTextField.setEnabled(False)

        #Reset polygon mode
        self.polygonAsString = ""

        #Reset boundary mode
        self.boundaryAsString = ""

        self.modesComboBox.setSelectedIndex(0)

    def actionPerformed(self, e):
        #Show the panel for configuring the favourite area of the
        #selected type
        if e.getSource() == self.modesComboBox:
            cl = self.configPanel.getLayout()
            selectedMode = self.modesStrings[self.modesComboBox.selectedIndex]
            cl.show(self.configPanel, selectedMode)
        #Activate bbox input for rectangular favourite zone mode
        elif e.getSource() == self.captureRBtn:
            self.bboxFromJosmBtn.setEnabled(True)
            self.bboxTextField.setEnabled(False)
        else:
            self.bboxFromJosmBtn.setEnabled(False)
            self.bboxTextField.setEnabled(True)

    def on_bboxFromJosmBtn_clicked(self, widget):
        """Read bbox currently shown in JOSM
        """
        bbox = self.app.get_frame_bounds()
        self.bboxPreviewTextField.setText(",".join(["%0.4f" % x for x in bbox]))

### Manage layer for creating a new favourite zone from polygon or boundary
    def create_new_zone_editing_layer(self, e=None):
        """Open a new dataset where the user can draw a closed way to
           delimit the favourite area
        """
        layer = self.get_new_zone_editing_layer()
        if layer is not None:
            self.app.mv.setActiveLayer(layer)
        else:
            Main.main.addLayer(OsmDataLayer(DataSet(), self.FAVAREALAYERNAME, None))
开发者ID:alex85k,项目名称:qat_script,代码行数:70,代码来源:NewZoneDialog.py

示例5: QatDialog

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

#.........这里部分代码省略.........
        """
        colors = {"white": (255, 255, 255),
                  "black": (0, 0, 0),
                  "green": (100, 200, 0),
                  "red": (200, 0, 0)}
        if color == "default":
            self.statsPanel.background = self.statsPanel_def_color
            self.checksTextFld.foreground = colors["black"]
        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)
开发者ID:floscher,项目名称:qat_script,代码行数:70,代码来源:QatDialog.py

示例6: __init__

# 需要导入模块: from javax.swing import JComboBox [as 别名]
# 或者: from javax.swing.JComboBox import setSelectedIndex [as 别名]
class StackOverlay:
    def __init__(self):
        self.frame = None
        self.overlayColorPreviewLabel = None
        self.showStackOverlayWindow()
        self.overlayColor = None

    def onQuit(self, e):
        print "Exiting..."
        self.frame.dispose()
        
    def showColorChooser(self, e):
        colorChooser = JColorChooser()
        self.overlayColor = colorChooser.showDialog(self.frame, "Choose color", Color.red)
        self.overlayColorPreviewLabel.setBackground(self.overlayColor)

    def showStackOverlayWindow(self):
        all = JPanel()
        all.setLayout(MigLayout())

        self.imageIDs = WindowManager.getIDList()
        self.imageNames = []

        if self.imageIDs is None:
            IJ.error("No open images", "Stack Overlay requires at least one image to be already open.")
            return

        for i in self.imageIDs:
            self.imageNames.append(WindowManager.getImage(i).getTitle())

        self.baseImageBox = JComboBox(self.imageNames)
        baseImageBoxLabel = JLabel("Base image")
        self.baseImageBox.setSelectedIndex(0)
        all.add(baseImageBoxLabel)
        all.add(self.baseImageBox, "wrap")

        self.overlayImageBox = JComboBox(self.imageNames)
        overlayImageBoxLabel = JLabel("Overlay image")
        if len(self.imageNames) > 1:
            self.overlayImageBox.setSelectedIndex(1)

        all.add(overlayImageBoxLabel)
        all.add(self.overlayImageBox, "wrap")

        all.add(JSeparator(SwingConstants.HORIZONTAL), "span, wrap")

        overlayStyleFrame = JPanel()
        overlayStyleFrame.setLayout(MigLayout())
        overlayStyleFrame.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder("Overlay Style"), BorderFactory.createEmptyBorder(5,5,5,5)))

        colorLabel = JLabel("Overlay color")
        self.overlayColorPreviewLabel = JLabel("           ")
        self.overlayColorPreviewLabel.setBorder(BorderFactory.createEmptyBorder(0,0,1,0))
        self.overlayColorPreviewLabel.setOpaque(True)
        self.overlayColorPreviewLabel.setBackground(Color.red)
        self.overlayColor = Color.red
        colorPicker = JColorChooser()
        colorPicker.setPreviewPanel(self.overlayColorPreviewLabel)
        colorButton = JButton("Select color...", actionPerformed=self.showColorChooser)

        opacityLabel = JLabel("Overlay opacity (%)")
        opacitySpinnerModel = SpinnerNumberModel(100, 0, 100, 1)
        self.opacitySpinner = JSpinner(opacitySpinnerModel)

        overlayStyleFrame.add(colorLabel)
        overlayStyleFrame.add(self.overlayColorPreviewLabel)
        overlayStyleFrame.add(colorButton, "wrap")

        overlayStyleFrame.add(opacityLabel)
        overlayStyleFrame.add(self.opacitySpinner, "wrap")
        

        all.add(overlayStyleFrame, "span, wrap")
        
        self.virtualStackCheckbox = JCheckBox("Use Virtual Stack", True)
        all.add(self.virtualStackCheckbox, "span, wrap")

        # TODO: add non-thermonuclear cancel button functionality
        overlayCancelButton = JButton("Cancel", actionPerformed=self.onQuit)
        overlayStartButton = JButton("Overlay images", actionPerformed=self.overlayImages)
        
        all.add(overlayCancelButton, "gapleft push")
        all.add(overlayStartButton, "gapleft push")

        self.frame = JFrame("Stack Overlay")
        self.frame.getContentPane().add(JScrollPane(all))
        self.frame.pack()
        self.frame.setLocationRelativeTo(None)
        self.frame.setVisible(True)
        
    def overlayImages(self, e):
        impBase = WindowManager.getImage(self.imageIDs[self.baseImageBox.getSelectedIndex()])
        refBase = impBase.getStack().getProcessor(1)
        
        impOverlay = WindowManager.getImage(self.imageIDs[self.overlayImageBox.getSelectedIndex()])
        refOverlay = impOverlay.getStack().getProcessor(1)
        
        print "Overlaying for stack sizes " + str(impBase.getStackSize()) + "/" + str(impOverlay.getStackSize()) + "..."
        
        stack = None
#.........这里部分代码省略.........
开发者ID:skalarproduktraum,项目名称:fiji-stackoverlay,代码行数:103,代码来源:Stack_Overlay.py

示例7: __init__

# 需要导入模块: from javax.swing import JComboBox [as 别名]
# 或者: from javax.swing.JComboBox import setSelectedIndex [as 别名]
    def __init__(self, view):
        JPanel.__init__(self)
        self.view = view
        self.background = Color.white
        self.config_panel_height = 60

        mainPanel = JPanel(background=self.background, layout=BorderLayout())
        mainPanel.border = self.RoundedBorder()
        configPanel = JPanel(background=self.background, visible=False)

        self.layout = BorderLayout()
        self.add(mainPanel, BorderLayout.NORTH)
        self.add(configPanel, BorderLayout.SOUTH)

        self.config_button = JButton(Icon.arrowdown, rolloverIcon=ShadedIcon.arrowdown, toolTipText='configure', actionPerformed=self.configure, borderPainted=False, focusPainted=False, contentAreaFilled=False)
        self.add(self.config_button)

        self.configPanel = configPanel

        self.slider = JSlider(0, 1, 0, background=self.background)
        self.slider.snapToTicks = True
        mainPanel.add(self.slider)
        self.slider.addChangeListener(self)

        self.min_time = JLabel(' 0.0000 ', opaque=True, background=self.background)
        self.max_time = JLabel(' 0.0000 ', opaque=True, background=self.background)

        self.left_panel = JPanel(background=self.background)
        self.left_panel.add(JButton(Icon.restart, rolloverIcon=ShadedIcon.restart, toolTipText='restart', actionPerformed=self.start, borderPainted=False, focusPainted=False, contentAreaFilled=False))
        self.left_panel.add(self.min_time)
        self.left_panel.add(JButton(icon=Icon.start, rolloverIcon=ShadedIcon.start, toolTipText='jump to beginning', actionPerformed=lambda x: self.slider.setValue(self.slider.minimum), borderPainted=False, focusPainted=False, contentAreaFilled=False))

        self.right_panel = JPanel(background=self.background)
        self.right_panel.add(JButton(icon=Icon.end, rolloverIcon=ShadedIcon.end, toolTipText='jump to end', actionPerformed=lambda x: self.slider.setValue(self.slider.maximum), borderPainted=False, focusPainted=False, contentAreaFilled=False))
        self.right_panel.add(self.max_time)
        self.playpause_button = JButton(Icon.play, actionPerformed=self.pause, rolloverIcon=ShadedIcon.play, toolTipText='continue', borderPainted=False, focusPainted=False, contentAreaFilled=False)
        self.right_panel.add(self.playpause_button)

        mainPanel.add(self.left_panel, BorderLayout.WEST)
        mainPanel.add(self.right_panel, BorderLayout.EAST)

        pdf = JPanel(layout=BorderLayout(), opaque=False)
        pdf.add(JButton(Icon.pdf, rolloverIcon=ShadedIcon.pdf, toolTipText='save pdf', actionPerformed=self.save_pdf, borderPainted=False, focusPainted=False, contentAreaFilled=False))
        pdf.add(JLabel('pdf', horizontalAlignment=javax.swing.SwingConstants.CENTER), BorderLayout.NORTH)
        pdf.maximumSize = pdf.preferredSize
        configPanel.add(pdf)

        self.data = JPanel(layout=BorderLayout(), opaque=False)
        self.data.add(JButton(Icon.data, rolloverIcon=ShadedIcon.data, toolTipText='examine data', actionPerformed=self.show_data, borderPainted=False, focusPainted=False, contentAreaFilled=False))
        self.data.add(JLabel('data', horizontalAlignment=javax.swing.SwingConstants.CENTER), BorderLayout.NORTH)
        self.data.maximumSize = self.data.preferredSize
        configPanel.add(self.data)

        mode = JPanel(layout=BorderLayout(), opaque=False)
        cb = JComboBox(['default', 'rate', 'direct'])
        if self.view.network.mode in [SimulationMode.DEFAULT, SimulationMode.PRECISE]:
            cb.setSelectedIndex(0)
        elif self.view.network.mode in [SimulationMode.RATE]:
            cb.setSelectedIndex(1)
        elif self.view.network.mode in [SimulationMode.DIRECT, SimulationMode.APPROXIMATE]:
            cb.setSelectedIndex(2)
        cb.addActionListener(self)
        self.mode_combobox = cb
        mode.add(cb)
        mode.add(JLabel('mode'), BorderLayout.NORTH)
        mode.maximumSize = mode.preferredSize
        configPanel.add(mode)

        dt = JPanel(layout=BorderLayout(), opaque=False)
        cb = JComboBox(['0.001', '0.0005', '0.0002', '0.0001'])
        cb.setSelectedIndex(0)
        self.view.dt = float(cb.getSelectedItem())
        cb.addActionListener(self)
        self.dt_combobox = cb
        dt.add(cb)
        dt.add(JLabel('time step'), BorderLayout.NORTH)
        dt.maximumSize = dt.preferredSize
        configPanel.add(dt)

        rate = JPanel(layout=BorderLayout(), opaque=False)
        self.rate_combobox = JComboBox(['fastest', '1x', '0.5x', '0.2x', '0.1x', '0.05x', '0.02x', '0.01x', '0.005x', '0.002x', '0.001x'])
        self.rate_combobox.setSelectedIndex(4)
        self.view.set_target_rate(self.rate_combobox.getSelectedItem())
        self.rate_combobox.addActionListener(self)
        rate.add(self.rate_combobox)
        rate.add(JLabel('speed'), BorderLayout.NORTH)
        rate.maximumSize = rate.preferredSize
        configPanel.add(rate)

        spin1 = JPanel(layout=BorderLayout(), opaque=False)
        self.record_time_spinner = JSpinner(SpinnerNumberModel((self.view.timelog.tick_limit - 1) * self.view.dt, 0.1, 100, 1), stateChanged=self.tick_limit)
        spin1.add(self.record_time_spinner)
        spin1.add(JLabel('recording time'), BorderLayout.NORTH)
        spin1.maximumSize = spin1.preferredSize
        configPanel.add(spin1)

        spin2 = JPanel(layout=BorderLayout(), opaque=False)
        self.filter_spinner = JSpinner(SpinnerNumberModel(self.view.tau_filter, 0, 0.5, 0.01), stateChanged=self.tau_filter)
        spin2.add(self.filter_spinner)
        spin2.add(JLabel('filter'), BorderLayout.NORTH)
#.........这里部分代码省略.........
开发者ID:Elhamahm,项目名称:nengo_1.4,代码行数:103,代码来源:timecontrol.py

示例8: TimeControl

# 需要导入模块: from javax.swing import JComboBox [as 别名]
# 或者: from javax.swing.JComboBox import setSelectedIndex [as 别名]
class TimeControl(JPanel, ChangeListener, ActionListener):
    def __init__(self, view):
        JPanel.__init__(self)
        self.view = view
        self.background = Color.white
        self.config_panel_height = 60

        mainPanel = JPanel(background=self.background, layout=BorderLayout())
        mainPanel.border = self.RoundedBorder()
        configPanel = JPanel(background=self.background, visible=False)

        self.layout = BorderLayout()
        self.add(mainPanel, BorderLayout.NORTH)
        self.add(configPanel, BorderLayout.SOUTH)

        self.config_button = JButton(Icon.arrowdown, rolloverIcon=ShadedIcon.arrowdown, toolTipText='configure', actionPerformed=self.configure, borderPainted=False, focusPainted=False, contentAreaFilled=False)
        self.add(self.config_button)

        self.configPanel = configPanel

        self.slider = JSlider(0, 1, 0, background=self.background)
        self.slider.snapToTicks = True
        mainPanel.add(self.slider)
        self.slider.addChangeListener(self)

        self.min_time = JLabel(' 0.0000 ', opaque=True, background=self.background)
        self.max_time = JLabel(' 0.0000 ', opaque=True, background=self.background)

        self.left_panel = JPanel(background=self.background)
        self.left_panel.add(JButton(Icon.restart, rolloverIcon=ShadedIcon.restart, toolTipText='restart', actionPerformed=self.start, borderPainted=False, focusPainted=False, contentAreaFilled=False))
        self.left_panel.add(self.min_time)
        self.left_panel.add(JButton(icon=Icon.start, rolloverIcon=ShadedIcon.start, toolTipText='jump to beginning', actionPerformed=lambda x: self.slider.setValue(self.slider.minimum), borderPainted=False, focusPainted=False, contentAreaFilled=False))

        self.right_panel = JPanel(background=self.background)
        self.right_panel.add(JButton(icon=Icon.end, rolloverIcon=ShadedIcon.end, toolTipText='jump to end', actionPerformed=lambda x: self.slider.setValue(self.slider.maximum), borderPainted=False, focusPainted=False, contentAreaFilled=False))
        self.right_panel.add(self.max_time)
        self.playpause_button = JButton(Icon.play, actionPerformed=self.pause, rolloverIcon=ShadedIcon.play, toolTipText='continue', borderPainted=False, focusPainted=False, contentAreaFilled=False)
        self.right_panel.add(self.playpause_button)

        mainPanel.add(self.left_panel, BorderLayout.WEST)
        mainPanel.add(self.right_panel, BorderLayout.EAST)

        pdf = JPanel(layout=BorderLayout(), opaque=False)
        pdf.add(JButton(Icon.pdf, rolloverIcon=ShadedIcon.pdf, toolTipText='save pdf', actionPerformed=self.save_pdf, borderPainted=False, focusPainted=False, contentAreaFilled=False))
        pdf.add(JLabel('pdf', horizontalAlignment=javax.swing.SwingConstants.CENTER), BorderLayout.NORTH)
        pdf.maximumSize = pdf.preferredSize
        configPanel.add(pdf)

        self.data = JPanel(layout=BorderLayout(), opaque=False)
        self.data.add(JButton(Icon.data, rolloverIcon=ShadedIcon.data, toolTipText='examine data', actionPerformed=self.show_data, borderPainted=False, focusPainted=False, contentAreaFilled=False))
        self.data.add(JLabel('data', horizontalAlignment=javax.swing.SwingConstants.CENTER), BorderLayout.NORTH)
        self.data.maximumSize = self.data.preferredSize
        configPanel.add(self.data)

        mode = JPanel(layout=BorderLayout(), opaque=False)
        cb = JComboBox(['default', 'rate', 'direct'])
        if self.view.network.mode in [SimulationMode.DEFAULT, SimulationMode.PRECISE]:
            cb.setSelectedIndex(0)
        elif self.view.network.mode in [SimulationMode.RATE]:
            cb.setSelectedIndex(1)
        elif self.view.network.mode in [SimulationMode.DIRECT, SimulationMode.APPROXIMATE]:
            cb.setSelectedIndex(2)
        cb.addActionListener(self)
        self.mode_combobox = cb
        mode.add(cb)
        mode.add(JLabel('mode'), BorderLayout.NORTH)
        mode.maximumSize = mode.preferredSize
        configPanel.add(mode)

        dt = JPanel(layout=BorderLayout(), opaque=False)
        cb = JComboBox(['0.001', '0.0005', '0.0002', '0.0001'])
        cb.setSelectedIndex(0)
        self.view.dt = float(cb.getSelectedItem())
        cb.addActionListener(self)
        self.dt_combobox = cb
        dt.add(cb)
        dt.add(JLabel('time step'), BorderLayout.NORTH)
        dt.maximumSize = dt.preferredSize
        configPanel.add(dt)

        rate = JPanel(layout=BorderLayout(), opaque=False)
        self.rate_combobox = JComboBox(['fastest', '1x', '0.5x', '0.2x', '0.1x', '0.05x', '0.02x', '0.01x', '0.005x', '0.002x', '0.001x'])
        self.rate_combobox.setSelectedIndex(4)
        self.view.set_target_rate(self.rate_combobox.getSelectedItem())
        self.rate_combobox.addActionListener(self)
        rate.add(self.rate_combobox)
        rate.add(JLabel('speed'), BorderLayout.NORTH)
        rate.maximumSize = rate.preferredSize
        configPanel.add(rate)

        spin1 = JPanel(layout=BorderLayout(), opaque=False)
        self.record_time_spinner = JSpinner(SpinnerNumberModel((self.view.timelog.tick_limit - 1) * self.view.dt, 0.1, 100, 1), stateChanged=self.tick_limit)
        spin1.add(self.record_time_spinner)
        spin1.add(JLabel('recording time'), BorderLayout.NORTH)
        spin1.maximumSize = spin1.preferredSize
        configPanel.add(spin1)

        spin2 = JPanel(layout=BorderLayout(), opaque=False)
        self.filter_spinner = JSpinner(SpinnerNumberModel(self.view.tau_filter, 0, 0.5, 0.01), stateChanged=self.tau_filter)
        spin2.add(self.filter_spinner)
#.........这里部分代码省略.........
开发者ID:Elhamahm,项目名称:nengo_1.4,代码行数:103,代码来源:timecontrol.py

示例9: BurpExtender

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

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

    def initTabs(self):
        #
        ##  init autorize tabs
        #
        
        self._splitpane = JSplitPane(JSplitPane.HORIZONTAL_SPLIT)
        self.scrollPane = JScrollPane(self.logTable)
        self._splitpane.setLeftComponent(self.scrollPane)
        colorsMenu = JMenu("Paint")
        redMenu = JMenuItem("Red")
        noneMenu = JMenuItem("None")
        greenMenu = JMenuItem("Green")
        redMenu.addActionListener(paintChange(self, "Red"))
        noneMenu.addActionListener(paintChange(self, None))
        greenMenu.addActionListener(paintChange(self, "Green"))
        colorsMenu.add(redMenu)
        colorsMenu.add(noneMenu)
        colorsMenu.add(greenMenu)
        
        
        self.menu = JPopupMenu("Popup")
        self.menu.add(colorsMenu)

        self.tabs = JTabbedPane()
        
        self.tabs.addTab("Request", self._requestViewer.getComponent())
        self.tabs.addTab("Response", self._responseViewer.getComponent())

        self.tabs.addTab("Vulnerability", self.pnl)

        self.tabs.addTab("Project Settings", self.projectSettings)
        
        self.tabs.setSelectedIndex(2)
        self._splitpane.setRightComponent(self.tabs)

    def initCallbacks(self):
        #
        ##  init callbacks
        #

        # customize our UI components
        self._callbacks.customizeUiComponent(self._splitpane)
        self._callbacks.customizeUiComponent(self.logTable)
        self._callbacks.customizeUiComponent(self.scrollPane)
        self._callbacks.customizeUiComponent(self.tabs)
        self._callbacks.registerContextMenuFactory(self)
        # add the custom tab to Burp's UI
        self._callbacks.addSuiteTab(self)


    def loadVulnerabilities(self, projPath):
        self.clearList(None)
        selected = False
        for root, dirs, files in os.walk(projPath): # make it go only for dirs
            for dirName in dirs:
                xmlPath = projPath+"/"+dirName+"/vulnerability.xml"
                # xmlPath = xmlPath.replace("/","//")
                document = self.getXMLDoc(xmlPath)
                nodeList = document.getDocumentElement().getChildNodes()
                vulnName = nodeList.item(0).getTextContent()
                severity = nodeList.item(1).getTextContent()
                description = nodeList.item(2).getTextContent()
                mitigation = nodeList.item(3).getTextContent()
                color = nodeList.item(4).getTextContent()
                test = vulnerability(vulnName,severity,description,mitigation,color)
开发者ID:anhnt4288,项目名称:PT-Manager,代码行数:70,代码来源:PTManager.py


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