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());
}
}
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());
}
}
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());
}
}
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;
}
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;
}
Aggregations