Java 类javax.swing.DefaultComboBoxModel 实例源码
项目:Neukoelln_SER316
文件:EditProjectTagController.java
private void init() {
projectTagsMdl = new DefaultComboBoxModel<String>();
prjToTagToEditedMap = new HashMap<Project, Map<String, String>>();
populateMap();
populateProjectComboBox();
projectBox.setSelectedIndex(0);
tagSelectBox.setModel(projectTagsMdl);
populateTagComboBox(projectBox.getItemAt(0));
tagSelectBox.setSelectedIndex(0);
projectBox.addItemListener(this);
tagSelectBox.addItemListener(this);
saveBtn.addActionListener(this);
removeBtn.addActionListener(this);
editTagTxtField.setFocusable(true);
editTagTxtField.addFocusListener(this);
this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
}
项目:NBANDROID-V2
文件:EditKeyStore.java
/**
* Creates new form EditKeyStore
*/
public EditKeyStore(KeyStore keyStore, String alias) {
initComponents();
this.keyStore = keyStore;
try {
ArrayList<String> list = Collections.list(keyStore.aliases());
aliases.setModel(new DefaultComboBoxModel<>(list.toArray(new String[list.size()])));
aliases.setSelectedItem(alias);
} catch (KeyStoreException ex) {
Exceptions.printStackTrace(ex);
}
useExisting.addActionListener(this);
createNew.addActionListener(this);
}
项目:AgentWorkbench
文件:ThreadMonitorToolBar.java
/**
* This method sets the default values for the ComboBoxModel of sampling interval.
* @return the combo box model recording interval
*/
private DefaultComboBoxModel<TimeSelection> getComboBoxModelRecordingInterval() {
if (comboBoxModelInterval==null) {
TimeSelection defaultTimeSelection = new TimeSelection(5000);
comboBoxModelInterval = new DefaultComboBoxModel<TimeSelection>();
comboBoxModelInterval.addElement(new TimeSelection(1000));
comboBoxModelInterval.addElement(new TimeSelection(2000));
comboBoxModelInterval.addElement(defaultTimeSelection);
comboBoxModelInterval.addElement(new TimeSelection(10000));
comboBoxModelInterval.addElement(new TimeSelection(15000));
comboBoxModelInterval.addElement(new TimeSelection(20000));
comboBoxModelInterval.addElement(new TimeSelection(30000));
comboBoxModelInterval.addElement(new TimeSelection(60000));
comboBoxModelInterval.setSelectedItem(defaultTimeSelection);
}
return comboBoxModelInterval;
}
项目:LOSY
文件:PruebaListCB.java
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jComboBox1 = new javax.swing.JComboBox<>();
jComboBox1.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(91, 91, 91)
.addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 230, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(149, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(39, 39, 39)
.addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(288, Short.MAX_VALUE))
);
}
项目:incubator-netbeans
文件:SearchPatternController.java
private void initHistory() {
final DefaultComboBoxModel model = new DefaultComboBoxModel();
final List<SearchPattern> data =
SearchHistory.getDefault().getSearchPatterns();
for (SearchPattern sp : data) {
model.addElement(new ModelItem(sp));
}
component.setModel(model);
if (data.size() > 0) {
setSearchPattern(data.get(0));
}
if (!FindDialogMemory.getDefault().isTextPatternSpecified()) {
component.setSelectedItem(""); //NOI18N
}
}
项目:AgentWorkbench
文件:TimeModelDiscreteConfiguration.java
/**
* This method initializes jComboBoxWidthUnit
* @return javax.swing.JComboBox
*/
private JComboBox<TimeUnit> getJComboBoxWidthUnit() {
if (jComboBoxWidthUnit == null) {
jComboBoxWidthUnit = new JComboBox<TimeUnit>(new DefaultComboBoxModel<TimeUnit>(new TimeUnitVector()));
jComboBoxWidthUnit.setPreferredSize(new Dimension(120, 26));
jComboBoxWidthUnit.setFont(new Font("Dialog", Font.PLAIN, 12));
jComboBoxWidthUnit.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (enabledChangeListener==true) {
saveTimeModelToSimulationSetup();
}
}
});
}
return jComboBoxWidthUnit;
}
项目:rapidminer
文件:DataEditor.java
public ValueTypeCellEditor(final int valueType) {
super(new JComboBox());
ComboBoxModel model = new DefaultComboBoxModel() {
private static final long serialVersionUID = 914764579359633239L;
private String[] valueTypes = new String[VALUE_TYPE_OPTIONS[valueType].length];
{
for (int i = 0; i < VALUE_TYPE_OPTIONS[valueType].length; i++) {
valueTypes[i] = Ontology.ATTRIBUTE_VALUE_TYPE.mapIndex(VALUE_TYPE_OPTIONS[valueType][i]);
}
}
@Override
public Object getElementAt(int index) {
return valueTypes[index];
}
@Override
public int getSize() {
return valueTypes.length;
}
};
((JComboBox) super.getComponent()).setEnabled(editValueTypes);
((JComboBox) super.getComponent()).setModel(model);
}
项目:incubator-netbeans
文件:PropertyPanel.java
/** Creates new form PropertyPanel */
public PropertyPanel(PropertiesPanel.PropertiesParamHolder propParam, boolean add, String propName, String propValue) {
initComponents();
provider = propParam.getProvider();
// The comb box only contains the property names that are not defined yet when adding
if (add) {
nameComboBox.setModel(new DefaultComboBoxModel(Util.getAvailPropNames(provider, propParam.getPU()).toArray(new String[]{})));
} else {
nameComboBox.setModel(new DefaultComboBoxModel(Util.getPropsNamesExceptGeneral(provider).toArray(new String[]{})));
nameComboBox.setSelectedItem(propName);
}
valueTextField = new JTextField();
valueComboBox = new JComboBox();
// Add the appropriate component for the value
String selectedPropName = (String) nameComboBox.getSelectedItem();
addValueComponent(selectedPropName, propValue);
nameComboBox.addActionListener((ActionListener) this);
// Disable the name combo box for editing
nameComboBox.setEnabled(add);
}
项目:incubator-netbeans
文件:PropertyPanel.java
public void addValueComponent(String propName, String propValue) {
valuePanel.removeAll();
Object possibleValue = PersistenceCfgProperties.getPossiblePropertyValue(provider, propName);
if (possibleValue == null) {
valuePanel.add(valueTextField, java.awt.BorderLayout.CENTER);
valueTextField.setText(propValue);
} else if (possibleValue instanceof String[]) {
valueComboBox.setModel( new DefaultComboBoxModel((String[]) possibleValue));
valueComboBox.setEditable(true);
valuePanel.add(valueComboBox, java.awt.BorderLayout.CENTER);
if (propValue != null) {
valueComboBox.setSelectedItem(propValue);
} else {
valueComboBox.setSelectedIndex(0);
}
}
this.revalidate();
this.repaint();
}
项目:sbc-qsystem
文件:FAdmin.java
private void butDeleteSpecScedActionPerformed(
java.awt.event.ActionEvent evt) {//GEN-FIRST:event_butDeleteSpecScedActionPerformed
if (listSpecSced.getSelectedIndex() != -1) {
if (0 != JOptionPane
.showConfirmDialog(this, "Do you really want remove the special schedule?",
"Removing",
JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE)) {
return;
}
QSpecSchedule sps = (QSpecSchedule) listSpecSced.getSelectedValue();
if (sps != null) {
final QCalendar item = (QCalendar) listCalendar.getSelectedValue();
if (item == null) {
return;
}
item.getSpecSchedules().remove(sps);
listSpecSced.setModel(new DefaultComboBoxModel(item.getSpecSchedules().toArray()));
}
}
}
项目:incubator-netbeans
文件:CustomizerDisplay.java
private void fillUpCategoryValue() {
categoryValue.setEnabled(false);
categoryValue.setModel(UIUtil.createComboWaitModel());
categoryValue.setSelectedItem(UIUtil.WAIT_VALUE);
ModuleProperties.RP.post(new Runnable() {
public void run() {
final SortedSet<String> moduleCategories = getProperties().getModuleCategories();
EventQueue.invokeLater(new Runnable() {
public void run() {
DefaultComboBoxModel model = new DefaultComboBoxModel();
categoryValue.removeAllItems();
for (String cat : moduleCategories) {
model.addElement(cat);
}
if (!moduleCategories.contains(getCategory())) {
// put module's own category at the beginning
model.insertElementAt(getCategory(), 0);
}
categoryValue.setModel(model);
categoryValue.setSelectedItem(getCategory());
categoryValue.setEnabled(true);
}
});
}
});
}
项目:incubator-netbeans
文件:MoveMappingFilePanel.java
private void updateRoots() {
Sources sources = ProjectUtils.getSources(project);
groups = sources.getSourceGroups(JavaProjectConstants.SOURCES_TYPE_RESOURCES);
if (groups == null || groups.length == 0) {
groups = sources.getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA);
}
int preselectedItem = 0;
for( int i = 0; i < groups.length; i++ ) {
if (fo!=null) {
try {
if (groups[i].contains(fo)) {
preselectedItem = i;
}
} catch (IllegalArgumentException e) {
// XXX this is a poor abuse of exception handling
// But can not find a better way
}
}
}
// Setup comboboxes
rootComboBox.setModel(new DefaultComboBoxModel(groups));
rootComboBox.setSelectedIndex(preselectedItem);
}
项目:AgentWorkbench
文件:AddComponentDialog.java
/**
* Gets the ComboBoxModel filter.
* @return the ComboBoxModel filter
*/
private DefaultComboBoxModel<String> getNewComboBoxModelFilter() {
Vector<String> filterStrings = new Vector<String>();
DefaultListModel<ComponentTypeListElement> typeList = this.getListModelComponentTypes();
for (int i=0; i < typeList.size(); i++) {
ComponentTypeListElement ctle = typeList.getElementAt(i);
if (filterStrings.contains(ctle.getDomain())==false) {
filterStrings.add(ctle.getDomain());
}
}
Collections.sort(filterStrings);
comboBoxModeFilter = new DefaultComboBoxModel<String>();
comboBoxModeFilter.addElement(AddComponentDialog.NoFilterString);
for (String filterString : filterStrings) {
comboBoxModeFilter.addElement(filterString);
}
return comboBoxModeFilter;
}
项目:Cognizant-Intelligent-Test-Scripter
文件:ImageSpy.java
private void showAddObjectView() {
if (cropCtrl.getCroppedImage() != null) {
layout.show(cardPanel, "object");
pageCombo.setModel(new DefaultComboBoxModel(imageOR.getPages().toArray()));
if (pageCombo.getItemCount() > 0) {
pageCombo.setSelectedIndex(pageCombo.getItemCount() - 1);
if (pageCombo.getSelectedIndex() != -1) {
loadGroupsForPage(pageCombo.getSelectedItem());
}
if (groupCombo.getSelectedIndex() != -1) {
loadObjectsForGroup(groupCombo.getSelectedItem());
}
}
setSize(getSize().width, 350);
} else {
Notification.show("No Object has been cropped");
addAsObject.setSelected(false);
}
}
项目:incubator-netbeans
文件:ColorComboBox.java
private static DefaultComboBoxModel createModel( Color[] colors, String[] names, boolean allowCustomColors ) {
DefaultComboBoxModel model = new DefaultComboBoxModel();
for( int i=0; i<colors.length; i++ ) {
Color c = colors[i];
String text = null;
if( i < names.length ) {
text = names[i];
}
if( null == text ) {
text = ColorValue.toText( c );
}
model.addElement( new ColorValue( text, c, false ) );
}
if( allowCustomColors ) {
model.addElement( ColorValue.CUSTOM_COLOR );
}
return model;
}
项目:Cognizant-Intelligent-Test-Scripter
文件:ImageSpy.java
private void loadGroupsForPage(Object obj) {
groupCombo.removeAllItems();
objectCombo.removeAllItems();
if (obj != null) {
if (obj instanceof ImageORPage) {
ImageORPage page = (ImageORPage) obj;
DefaultComboBoxModel objGroupModel = new DefaultComboBoxModel(page.getObjectGroups().toArray());
if (isObjectGroup.isSelected()) {
groupCombo.setModel(objGroupModel);
groupCombo.setSelectedIndex(-1);
if (groupCombo.getItemCount() > 0) {
groupCombo.setSelectedIndex(groupCombo.getItemCount() - 1);
}
} else {
objectCombo.setModel(objGroupModel);
}
}
}
}
项目:incubator-netbeans
文件:FindBar.java
public FindBar(FindSupport support) {
this.support = support;
initComponents();
lastSearchModel = new DefaultComboBoxModel();
findCombo.setModel(lastSearchModel);
findCombo.setSelectedItem(""); // NOI18N
initialized = true;
addComboEditorListener();
InputMap inputMap = getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
String closeKey = "close"; // NOI18N
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), closeKey);
getActionMap().put(closeKey, new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
FindBar.this.support.cancel();
}
});
}
项目:incubator-netbeans
文件:ETable.java
private ComboBoxModel getSearchComboModel() {
DefaultComboBoxModel result = new DefaultComboBoxModel();
for (Enumeration en = getColumnModel().getColumns(); en.hasMoreElements(); ) {
Object column = en.nextElement();
if (column instanceof ETableColumn) {
ETableColumn etc = (ETableColumn)column;
Object value = etc.getHeaderValue();
String valueString = "";
if (value != null) {
valueString = value.toString();
}
valueString = getColumnDisplayName(valueString);
result.addElement(valueString);
}
}
return result;
}
项目:jaer
文件:eDVS128_InterfaceFactory.java
@Override
public void run() {
log.info("starting thread to initialize serial port list");
refreshSerialPortList();
hostTF.setText(prefs.get("eDVS128_InterfaceFactory.HOST", HOST));
portTF.setText(prefs.get("eDVS128_InterfaceFactory.TCP_PORT", Integer.toString(TCP_PORT)));
Vector<String> brVec = new Vector();
for (int i : SERIAL_BAUD_RATES_MBPS) {
brVec.add(Integer.toString(i));
}
baudRateCB.setModel(new DefaultComboBoxModel<String>(brVec));
for (int i = 0; i < SERIAL_BAUD_RATES_MBPS.length; i++) {
if (SERIAL_BAUD_RATES_MBPS[i] == serialBaudRateMbps) {
baudRateCB.setSelectedIndex(i);
}
}
focusLast();
log.info("serial port initialization thread done");
}
项目:incubator-netbeans
文件:ResolveIssuePanel.java
public ResolveIssuePanel(BugzillaIssue issue) {
this.issue = issue;
initComponents();
// workaround for 0 size container gap caused by invisible duplicatePanel
((javax.swing.GroupLayout)getLayout()).setHonorsVisibility(false);
BugzillaRepository repository = issue.getRepository();
BugzillaConfiguration bc = repository.getConfiguration();
if(bc == null || !bc.isValid()) {
// XXX nice error msg?
return;
}
List<String> resolutions = new LinkedList<String>(bc.getResolutions());
resolutions.remove("MOVED"); // NOI18N
duplicatePanel.setVisible(false);
resolutionCombo.setModel(new DefaultComboBoxModel(resolutions.toArray()));
org.openide.awt.Mnemonics.setLocalizedText(ok, NbBundle.getMessage(ResolveIssuePanel.class, "ResolveIssuePanel.resolveButton")); // NOI18N
}
项目:incubator-netbeans
文件:ShowEffPomDiffPanel.java
/**
* Creates new form ShowEffPomDiffPanel
*/
public ShowEffPomDiffPanel(ProjectConfigurationProvider<MavenConfiguration> configs) {
initComponents();
ComboBoxModel<MavenConfiguration> model = new DefaultComboBoxModel<MavenConfiguration>(configs.getConfigurations().toArray(new MavenConfiguration[0]));
comConfiguration.setModel(model);
comConfiguration.setEditable(false);
comConfiguration.setRenderer(new DefaultListCellRenderer() {
@Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
return super.getListCellRendererComponent(list, ((ProjectConfiguration)value).getDisplayName(), index, isSelected, cellHasFocus);
}
});
comConfiguration.setSelectedItem(configs.getActiveConfiguration());
enableFields();
epProperties.setContentType("text/x-properties");
}
项目:incubator-netbeans
文件:Repository.java
public void selectUrl (final SVNUrl url, final boolean force) {
Mutex.EVENT.readAccess(new Mutex.Action<Void>() {
@Override
public Void run () {
DefaultComboBoxModel dcbm = (DefaultComboBoxModel) repositoryPanel.urlComboBox.getModel();
int idx = dcbm.getIndexOf(url.toString());
if(idx > -1) {
dcbm.setSelectedItem(url.toString());
} else if(force) {
RepositoryConnection rc = new RepositoryConnection(url.toString());
dcbm.addElement(rc);
dcbm.setSelectedItem(rc);
}
return null;
}
});
}
项目:Moenagade
文件:ConfigureParameters.java
/**
* Creates new form ConfigureParameters
*/
public ConfigureParameters() {
initComponents();
setModal(true);
Vector<String> entries = new Vector<>();
entries.add("int");
entries.add("double");
entries.add("boolean");
entries.add("String");
entries.add("long");
entries.add("float");
entries.addAll(Library.getInstance().getProject().getEntityNames());
cbParamType.setModel(new DefaultComboBoxModel(entries));
}
项目:freecol
文件:NegotiationDialog.java
/**
* Creates a new {@code UnitTradeItemPanel} instance.
*
* @param source The {@code Player} nominally in posession of the
* unit (this may be totally fictional).
* @param allUnits The {@code Unit}s to trade.
*/
public UnitTradeItemPanel(Player source, List<Unit> allUnits) {
this.source = source;
this.unitBox = new JComboBox<>(new DefaultComboBoxModel<Unit>());
this.unitBox.setRenderer(new UnitBoxRenderer());
this.clearButton = Utility.localizedButton("negotiationDialog.clear");
this.clearButton.addActionListener(this);
this.clearButton.setActionCommand(CLEAR);
this.addButton = Utility.localizedButton("negotiationDialog.add");
this.addButton.addActionListener(this);
this.addButton.setActionCommand(ADD);
this.label = Utility.localizedLabel(Messages.nameKey("model.tradeItem.unit"));
this.allUnits = allUnits;
setLayout(new MigLayout("wrap 1", "", ""));
setBorder(Utility.SIMPLE_LINE_BORDER);
add(this.label);
add(this.unitBox);
add(this.clearButton, "split 2");
add(this.addButton);
setSize(getPreferredSize());
}
项目:FreeCol
文件:ModOptionUI.java
/**
* Creates a new {@code ModOptionUI} for the given
* {@code ModOption}.
*
* @param option The {@code ModOption} to make a user interface for
* @param editable boolean whether user can modify the setting
*/
public ModOptionUI(final ModOption option, boolean editable) {
super(option, editable);
DefaultComboBoxModel<FreeColModFile> model
= new DefaultComboBoxModel<>();
for (FreeColModFile choice : option.getChoices()) {
model.addElement(choice);
}
this.box = new JComboBox<>();
this.box.setModel(model);
this.box.setRenderer(new BoxRenderer());
if (option.getValue() != null) {
this.box.setSelectedItem(option.getValue());
}
initialize();
}
项目:Cognizant-Intelligent-Test-Scripter
文件:DriverSettings.java
private void renameEmulator() {
String oldName = browserCombo.getSelectedItem().toString();
String newEmName = browserCombo.getEditor().getItem().toString();
if (!oldName.equals(newEmName)) {
if (!getTotalBrowserList().contains(newEmName)) {
Emulator emulator = settings.getEmulators().getEmulator(oldName);
emulator.setName(newEmName);
DefaultComboBoxModel combomodel = (DefaultComboBoxModel) browserCombo.getModel();
DefaultComboBoxModel dupCombomodel = (DefaultComboBoxModel) dupDriverCombo.getModel();
int index = browserCombo.getSelectedIndex();
combomodel.removeElement(oldName);
dupCombomodel.removeElement(oldName);
combomodel.insertElementAt(newEmName, index);
dupCombomodel.insertElementAt(newEmName, index);
browserCombo.setSelectedIndex(index);
} else {
Notification.show("Emulator/Browser [" + newEmName + "] already Present");
}
}
}
项目:VASSAL-src
文件:ImagePicker.java
public void pickImage() {
final FileChooser fc = GameModule.getGameModule().getFileChooser();
fc.setFileFilter(new ImageFileFilter());
if (fc.showOpenDialog(this) == FileChooser.APPROVE_OPTION
&& fc.getSelectedFile().exists()) {
String name = fc.getSelectedFile().getName();
GameModule.getGameModule()
.getArchiveWriter()
.addImage(fc.getSelectedFile().getPath(), name);
select.setModel(new DefaultComboBoxModel(
ArrayUtils.prepend(GameModule.getGameModule().getDataArchive().getImageNames(), NO_IMAGE)));
setImageName(name);
}
else {
setImageName(NO_IMAGE);
}
repaint();
}
项目:incubator-netbeans
文件:SvnHookTest.java
private void setRepository(Repository repository, HookPanel panel) throws IllegalArgumentException, IllegalAccessException {
Field[] fs = panel.qs.getClass().getDeclaredFields();
for (Field f : fs) {
if(f.getType() == QuickSearchPanel.class) {
f.setAccessible(true);
QuickSearchPanel qsp = (QuickSearchPanel) f.get(panel.qs);
fs = qsp.getClass().getDeclaredFields();
for (Field f2 : fs) {
if(f2.getType() == JComboBox.class) {
f2.setAccessible(true);
JComboBox cmb = (JComboBox) f2.get(qsp);
DefaultComboBoxModel model = new DefaultComboBoxModel(new Repository[] {repository});
cmb.setModel(model);
cmb.setSelectedItem(repository);
return;
}
}
}
}
}
项目:freecol
文件:NegotiationDialog.java
/**
* Creates a new {@code GoodsTradeItemPanel} instance.
*
* @param source The {@code Player} nominally in possession of the
* goods (this may be totally fictional).
* @param allGoods The {@code Goods} to trade.
*/
public GoodsTradeItemPanel(Player source, List<Goods> allGoods) {
this.source = source;
this.goodsBox = new JComboBox<>(new DefaultComboBoxModel<Goods>());
this.goodsBox.setRenderer(new GoodsBoxRenderer());
this.clearButton = Utility.localizedButton("negotiationDialog.clear");
this.clearButton.addActionListener(this);
this.clearButton.setActionCommand(CLEAR);
this.addButton = Utility.localizedButton("negotiationDialog.add");
this.addButton.addActionListener(this);
this.addButton.setActionCommand(ADD);
this.label = Utility.localizedLabel(Messages.nameKey("model.tradeItem.goods"));
this.allGoods = allGoods;
setLayout(new MigLayout("wrap 1", "", ""));
setBorder(Utility.SIMPLE_LINE_BORDER);
add(this.label);
add(this.goodsBox);
add(this.clearButton, "split 2");
add(this.addButton);
setSize(getPreferredSize());
}
项目:freecol
文件:StringOptionUI.java
/**
* Creates a new {@code StringOptionUI} for the given
* {@code StringOption}.
*
* @param option The {@code StringOption} to make a user
* interface for.
* @param editable Whether user can modify the setting.
*/
public StringOptionUI(final StringOption option, boolean editable) {
super(option, editable);
List<String> choices = option.getChoices();
box.setModel(new DefaultComboBoxModel<>(choices
.toArray(new String[choices.size()])));
box.setSelectedItem(option.getValue());
box.setRenderer(new FreeColComboBoxRenderer<String>("", true));
initialize();
}
项目:litiengine
文件:StaticShadowPanel.java
public StaticShadowPanel() {
TitledBorder border = new TitledBorder(new LineBorder(new Color(128, 128, 128)), Resources.get("panel_staticShadow"), TitledBorder.LEADING, TitledBorder.TOP, null, null);
border.setTitleFont(border.getTitleFont().deriveFont(Font.BOLD));
setBorder(border);
JLabel lblShadowType = new JLabel(Resources.get("panel_shadowType"));
comboBoxShadowType = new JComboBox<>();
comboBoxShadowType.setModel(new DefaultComboBoxModel<StaticShadowType>(StaticShadowType.values()));
GroupLayout groupLayout = new GroupLayout(this);
groupLayout.setHorizontalGroup(
groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addContainerGap()
.addComponent(lblShadowType, GroupLayout.PREFERRED_SIZE, 51, GroupLayout.PREFERRED_SIZE)
.addGap(10)
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addComponent(comboBoxShadowType, 0, 95, Short.MAX_VALUE)
.addGap(4)))));
groupLayout.setVerticalGroup(
groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
.addComponent(comboBoxShadowType, GroupLayout.PREFERRED_SIZE, 19, GroupLayout.PREFERRED_SIZE)
.addComponent(lblShadowType, GroupLayout.PREFERRED_SIZE, 13, GroupLayout.PREFERRED_SIZE))
.addPreferredGap(ComponentPlacement.UNRELATED)
.addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
setLayout(groupLayout);
this.setupChangedListeners();
}
项目:ramus
文件:JFontComboBox.java
public JFontComboBox() {
super();
final DefaultComboBoxModel model = new DefaultComboBoxModel();
setModel(model);
setMaximumRowCount(16);
setRenderer(mr);
for (final String element : fns)
addItem(element);
setEditable(true);
}
项目:ISO8583
文件:PnlISOProperties.java
public PnlISOProperties(final Iso8583Config isoConfig) {
setLayout(null);
setBorder(new TitledBorder(null, "ISO8583 Properties", TitledBorder.LEADING, TitledBorder.TOP, null, null));
lblDelimiter.setBounds(12, 27, 83, 16);
lblDelimiter.setHorizontalAlignment(SwingConstants.RIGHT);
cmbDelimiter.setModel(new DefaultComboBoxModel<DelimiterEnum>(new DelimiterEnum[] {
DelimiterEnum.LENGTH2_DELIMITER_BEG, DelimiterEnum.LENGTH4_DELIMITER_BEG, DelimiterEnum.GENERIC_CONFIG_DELIMITER}));
cmbDelimiter.setBounds(101, 24, 300, 22);
cmbDelimiter.setSelectedIndex(0);
cmbDelimiter.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
txtDesc.setText(((DelimiterEnum) cmbDelimiter.getSelectedItem()).getDelimiter().getDesc());
save(isoConfig);
}
});
txtDesc.setEditable(false);
txtDesc.setLineWrap(true);
scrDesc.setViewportView(txtDesc);
scrDesc.setBounds(101, 59, 300, 111);
add(lblDelimiter);
add(cmbDelimiter);
add(scrDesc);
}
项目:jaer
文件:ShiftedSourceControlsCF.java
/**
* Creates new form IPotSliderTextControl
*/
public ShiftedSourceControlsCF(ShiftedSourceBiasCF pot) {
this.pot = pot;
initComponents(); // this has unfortunate byproduect of resetting pot value to 0... don't know how to prevent stateChanged event
dontProcessRegBiasSlider = true;
regBiasSlider.setMaximum(pot.maxRegBitValue - 1); // TODO replace with getter, needed to prevent extraneous callbacks
dontProcessRefSlider = true;
refBiasSlider.setMaximum(pot.maxRefBitValue - 1);
operatingModeComboBox.setModel(new DefaultComboBoxModel(OperatingMode.values()));
voltageLevelComboBox.setModel(new DefaultComboBoxModel(VoltageLevel.values()));
if (pot != null) {
nameLabel.setText(pot.getName()); // the name of the bias
nameLabel.setHorizontalAlignment(SwingConstants.TRAILING);
nameLabel.setBorder(null);
if (pot.getTooltipString() != null) {
nameLabel.setToolTipText(pot.getTooltipString());
}
bitPatternTextField.setColumns(pot.getNumBits() + 1);
pot.loadPreferences(); // to get around slider value change
pot.addObserver(this); // when pot changes, so does this gui control view
}
setAlignmentX(LEFT_ALIGNMENT);
updateAppearance(); // set controls up with values from ipot
allInstances.add(this);
setBitViewEnabled(true);
}
项目:rapidminer
文件:ManageDatabaseDriversDialog.java
public DriverPane() {
this.setLayout(new GridBagLayout());
this.classNameCombo.setEditable(true);
JButton fileButton = new JButton(new ResourceAction(true, "manage_database_drivers.jarfile", new Object[0]) {
private static final long serialVersionUID = 1L;
public void actionPerformed(ActionEvent e) {
File file = SwingTools.chooseFile(DriverPane.this, (File)null, true, "jar", "JDBC driver jar file");
if(file != null) {
DriverPane.this.jarFileField.setText(file.getAbsolutePath());
((DefaultComboBoxModel)DriverPane.this.classNameCombo.getModel()).removeAllElements();
Iterator var3 = ManageDatabaseDriversDialog.this.findDrivers(file).iterator();
while(var3.hasNext()) {
String driver = (String)var3.next();
((DefaultComboBoxModel)DriverPane.this.classNameCombo.getModel()).addElement(driver);
}
}
}
});
this.add("name", this.nameField, (JComponent)null);
this.add("urlprefix", this.urlprefixField, (JComponent)null);
this.add("port", this.portField, (JComponent)null);
this.add("dbseparator", this.dbseparatorField, (JComponent)null);
this.add("jarfile", this.jarFileField, fileButton);
this.add("classname", this.classNameCombo, (JComponent)null);
}
项目:ObsidianSuite
文件:EntitySetupPartPanel.java
private void updateGroupComboBoxes()
{
for(PartPanel p : partPanels)
{
p.box.setModel(new DefaultComboBoxModel(controller.getPartGroups().getGroupListAsArray()));
p.box.setSelectedItem(controller.getPartGroups().getPartGroup(p.part));
}
}
项目:RA-Reader
文件:IndikationGUI.java
public IndikationGUI(int regNr, int zuNr) throws IOException {
initComponents();
this.regNr = regNr;
this.zuNr = zuNr;
DataGetter dg = new DataGetter();
numbersInt = dg.getAllIndikation(regNr, zuNr);
ArrayList numbers = numbersInt;
for (int i = 0; i < numbers.size(); i++) {
String s = "" + numbers.get(i);
numbers.set(i, s + ". Indikation");
}
cb_indikationen.setModel(new DefaultComboBoxModel(numbers.toArray()));
tb_indiInfos.setModel(new IndikationTable(regNr, zuNr, 1));
}
项目:Recaf
文件:LabelSwitcherPanel.java
private void populate(InsnList opcodes) {
int selected = -1, labelCount = 0;;
DefaultComboBoxModel<String> model = new DefaultComboBoxModel<>();
for (int i = 0; i < opcodes.size(); i++) {
AbstractInsnNode ain = opcodes.get(i);
if (ain.getType() == AbstractInsnNode.LABEL) {
LabelNode label = (LabelNode) ain;
String s = i + ".";
if (list != null) {
s += " : " + list.getLabelName(ain);
}
labels.put(s, label);
model.addElement(s);
if (label.equals(initial)) {
selected = labelCount;
}
labelCount++;
}
}
combo.setModel(model);
combo.setSelectedIndex(selected);
combo.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
updater.accept(labels.get(e.getItem()));
if (list != null) {
list.repaint();
}
}
});
}
项目:sumo
文件:ImagePanel.java
/** Creates new form ImagePanel */
public ImagePanel(ImageLayer layer) {
initComponents();
this.layer = layer;
jSlider1.setValue((int) (10 * layer.getContrast()));
jSlider2.setValue((int) layer.getBrightness());
jLabel4.setText("" + layer.getNumberOfBands());
jComboBox1.setModel(new DefaultComboBoxModel(new String[]{"point","polygon"}));
setBands();
}
项目:poe-ladder-tracker-java
文件:GUIStartup.java
private void configureComboBoxMode(){
comboBoxMode.setModel(new DefaultComboBoxModel<String>(new String[] {"CSV", "API"}));
if(prefComboBoxModeSelectedItem == 0){
prefs.put("LadderTrackerMode", Integer.toString(0));
comboBoxMode.setSelectedItem("CSV");
}
else{
prefs.put("LadderTrackerMode", Integer.toString(1));
comboBoxMode.setSelectedItem("API");
}
comboBoxMode.addItemListener(comboBoxListener);
}