Search in sources :

Example 21 with JComboBox

use of javax.swing.JComboBox in project zaproxy by zaproxy.

the class StandardFieldsDialog method setComboFields.

public void setComboFields(String fieldLabel, String[] choices, String value) {
    Component c = this.fieldMap.get(fieldLabel);
    if (c instanceof JComboBox) {
        @SuppressWarnings("unchecked") JComboBox<String> comboBox = (JComboBox<String>) c;
        comboBox.removeAllItems();
        for (String str : choices) {
            comboBox.addItem(str);
        }
        if (value != null) {
            comboBox.setSelectedItem(value);
        }
    } else if (c == null) {
        // Ignore - could be during init
        logger.debug("No field for " + fieldLabel);
    } else {
        logger.error("Unrecognised field class " + fieldLabel + ": " + c.getClass().getCanonicalName());
    }
}
Also used : JComboBox(javax.swing.JComboBox) JComponent(javax.swing.JComponent) Component(java.awt.Component)

Example 22 with JComboBox

use of javax.swing.JComboBox in project zaproxy by zaproxy.

the class StandardFieldsDialog method setComboBoxModel.

/**
	 * Sets the given combo box model into the combo box with the given label.
	 * <p>
	 * Control of selection state (i.e. set/get selected item) is done through the combo box model.
	 * 
	 * @param <E> the type of the elements of the combo box model.
	 * @param fieldLabel the name of the label of the combo box field
	 * @param comboBoxModel the model to set into the combo box
	 * @since TODO add version
	 * @see #addComboField(String, ComboBoxModel)
	 * @see #addComboField(int, String, ComboBoxModel)
	 */
public <E> void setComboBoxModel(String fieldLabel, ComboBoxModel<E> comboBoxModel) {
    Component c = this.fieldMap.get(fieldLabel);
    if (c instanceof JComboBox) {
        @SuppressWarnings("unchecked") JComboBox<E> comboBox = (JComboBox<E>) c;
        comboBox.setModel(comboBoxModel);
    } else if (c == null) {
        // Ignore - could be during init
        logger.debug("No field for " + fieldLabel);
    } else {
        logger.error("Unrecognised field class " + fieldLabel + ": " + c.getClass().getCanonicalName());
    }
}
Also used : JComboBox(javax.swing.JComboBox) JComponent(javax.swing.JComponent) Component(java.awt.Component)

Example 23 with JComboBox

use of javax.swing.JComboBox in project zaproxy by zaproxy.

the class StandardFieldsDialog method setComboFields.

public void setComboFields(String fieldLabel, List<String> choices, String value) {
    Component c = this.fieldMap.get(fieldLabel);
    if (c instanceof JComboBox) {
        @SuppressWarnings("unchecked") JComboBox<String> comboBox = (JComboBox<String>) c;
        comboBox.removeAllItems();
        for (String str : choices) {
            comboBox.addItem(str);
        }
        if (value != null) {
            comboBox.setSelectedItem(value);
        }
    } else if (c == null) {
        // Ignore - could be during init
        logger.debug("No field for " + fieldLabel);
    } else {
        logger.error("Unrecognised field class " + fieldLabel + ": " + c.getClass().getCanonicalName());
    }
}
Also used : JComboBox(javax.swing.JComboBox) JComponent(javax.swing.JComponent) Component(java.awt.Component)

Example 24 with JComboBox

use of javax.swing.JComboBox in project ACS by ACS-Community.

the class LogToolBar method getLogLevelCB.

/**
     * 
     * @return The log level CB
     */
public JComboBox getLogLevelCB() {
    if (logLevelCB == null) {
        // Add the ComboBox for the log level
        LogTypeHelper[] types = LogTypeHelper.values();
        int t = 0;
        //    		for (LogTypeHelper logType: LogTypeHelper.values()) {
        //    			Descriptions[t++]=logType.logEntryType;
        //            }
        logLevelCB = new JComboBox(types);
        // Build the renderer for the combo boxes
        LogTypeRenderer rendererCB = new LogTypeRenderer();
        logLevelCB.setSelectedItem(initialLogLevel);
        logLevelCB.setEditable(false);
        logLevelCB.setMaximumRowCount(LogTypeHelper.values().length);
        logLevelCB.setRenderer(rendererCB);
    }
    return logLevelCB;
}
Also used : JComboBox(javax.swing.JComboBox) LogTypeRenderer(com.cosylab.logging.settings.LogTypeRenderer) LogTypeHelper(com.cosylab.logging.engine.log.LogTypeHelper)

Example 25 with JComboBox

use of javax.swing.JComboBox in project ACS by ACS-Community.

the class ScriptFilter method getPropertyComboBox.

/**
	 * This method initializes PropertyComboBox
	 * @return javax.swing.JComboBox
	 */
private JComboBox getPropertyComboBox() {
    if (PropertyComboBox == null) {
        PropertyComboBox = new JComboBox();
        PropertyComboBox.setPreferredSize(new Dimension(320, 24));
    //PropertyComboBox.setSize(PropertyComboBox.getPreferredSize());
    }
    return PropertyComboBox;
}
Also used : JComboBox(javax.swing.JComboBox) Dimension(java.awt.Dimension)

Aggregations

JComboBox (javax.swing.JComboBox)150 JLabel (javax.swing.JLabel)66 JPanel (javax.swing.JPanel)57 ActionEvent (java.awt.event.ActionEvent)51 ActionListener (java.awt.event.ActionListener)48 JButton (javax.swing.JButton)47 JScrollPane (javax.swing.JScrollPane)28 JTextField (javax.swing.JTextField)27 BoxLayout (javax.swing.BoxLayout)26 Dimension (java.awt.Dimension)25 JCheckBox (javax.swing.JCheckBox)23 JTable (javax.swing.JTable)22 BorderLayout (java.awt.BorderLayout)21 GridBagLayout (java.awt.GridBagLayout)20 Insets (java.awt.Insets)20 GridBagConstraints (java.awt.GridBagConstraints)19 FlowLayout (java.awt.FlowLayout)18 DefaultCellEditor (javax.swing.DefaultCellEditor)17 TableColumn (javax.swing.table.TableColumn)14 ItemEvent (java.awt.event.ItemEvent)11