本文整理了Java中javax.swing.JComboBox.getModel()
方法的一些代码示例,展示了JComboBox.getModel()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JComboBox.getModel()
方法的具体详情如下:
包路径:javax.swing.JComboBox
类名称:JComboBox
方法名:getModel
暂无
代码示例来源:origin: groovy/groovy-core
/**
* Returns an {@link java.util.Iterator} which traverses the ComboBox one item at a time.
*
* @param self a ComboBox
* @return an Iterator for a ComboBox
* @since 1.6.4
*/
public static Iterator iterator(JComboBox self) {
return iterator(self.getModel());
}
代码示例来源:origin: groovy/groovy-core
protected void syntheticUnbind() {
boundComboBox.removePropertyChangeListener("model", this);
boundComboBox.getModel().removeListDataListener(this);
}
代码示例来源:origin: groovy/groovy-core
protected void syntheticBind() {
boundComboBox = (JComboBox) ((PropertyBinding)sourceBinding).getBean();
boundComboBox.addPropertyChangeListener("model", this);
boundComboBox.getModel().addListDataListener(this);
}
代码示例来源:origin: libgdx/libgdx
private void set (DynamicsInfluencer influencer) {
//Clear
for (int i = velocityTableModel.getRowCount() - 1; i >= 0; i--) {
velocityTableModel.removeRow(i);
}
velocities.clear();
//Add
for(int i=0, c = influencer.velocities.size; i < c; ++i){
velocities.add(new VelocityWrapper((DynamicsModifier)influencer.velocities.items[i], true));
velocityTableModel.addRow(new Object[] {"Velocity "+i, true});
}
DefaultComboBoxModel model = (DefaultComboBoxModel) velocityBox.getModel();
model.removeAllElements();
for(Object velocityObject : getAvailableVelocities(editor.getControllerType())){
model.addElement(velocityObject);
}
}
代码示例来源:origin: libgdx/libgdx
private void set (DynamicsInfluencer influencer) {
//Clear
for (int i = velocityTableModel.getRowCount() - 1; i >= 0; i--) {
velocityTableModel.removeRow(i);
}
velocities.clear();
//Add
for(int i=0, c = influencer.velocities.size; i < c; ++i){
velocities.add(new VelocityWrapper((DynamicsModifier)influencer.velocities.items[i], true));
velocityTableModel.addRow(new Object[] {"Velocity "+i, true});
}
DefaultComboBoxModel model = (DefaultComboBoxModel) velocityBox.getModel();
model.removeAllElements();
for(Object velocityObject : getAvailableVelocities(editor.getControllerType())){
model.addElement(velocityObject);
}
}
代码示例来源:origin: libgdx/libgdx
if(controller != null){
DefaultComboBoxModel model = (DefaultComboBoxModel)influencerBox.getModel();
ControllerType type = getControllerType();
if(type != null){
代码示例来源:origin: libgdx/libgdx
if(controller != null){
DefaultComboBoxModel model = (DefaultComboBoxModel)influencerBox.getModel();
ControllerType type = getControllerType();
if(type != null){
代码示例来源:origin: geotools/geotools
public void actionPerformed(ActionEvent e) {
lineWidth =
((Number) lineWidthCBox.getModel().getSelectedItem()).intValue();
}
});
代码示例来源:origin: geotools/geotools
public void actionPerformed(ActionEvent e) {
pointSize =
((Number) pointSizeCBox.getModel().getSelectedItem()).intValue();
}
});
代码示例来源:origin: geotools/geotools
public void actionPerformed(ActionEvent e) {
labelField = labelCBox.getModel().getSelectedItem().toString();
}
});
代码示例来源:origin: magefree/mage
private void loadBoosterPacks(String packString) {
if (!packString.isEmpty()) {
String[] packsArray = packString.substring(1, packString.length() - 1).split(",");
int packNumber = 0;
for (String pack : packsArray) {
packNumber++;
if (this.packPanels.size() >= packNumber - 1) {
JPanel panel = packPanels.get(packNumber - 1);
JComboBox comboBox = findComboInComponent(panel);
if (comboBox != null) {
ComboBoxModel model = comboBox.getModel();
int size = model.getSize();
for (int i = 0; i < size; i++) {
ExpansionInfo element = (ExpansionInfo) model.getElementAt(i);
if (element.getCode().equals(pack.trim())) {
comboBox.setSelectedIndex(i);
break;
}
}
} else {
logger.error("Can't find combo component in " + panel.toString());
}
}
}
}
}
代码示例来源:origin: geotools/geotools
/**
* Set items for the given point size
*
* @param value point size
*/
private void setPointSizeItems(double value) {
pointSize = (float) Math.max(0.0, value);
int newValue = (int) pointSize;
MutableComboBoxModel model = (MutableComboBoxModel) pointSizeCBox.getModel();
int insert = -1;
for (int i = 0; i < model.getSize(); i++) {
int elValue = ((Number) model.getElementAt(i)).intValue();
if (elValue == newValue) {
pointSizeCBox.setSelectedIndex(i);
return;
} else if (elValue > newValue) {
insert = i;
break;
}
}
if (insert < 0) {
insert = model.getSize();
model.addElement(Integer.valueOf(newValue));
} else {
model.insertElementAt(Integer.valueOf(newValue), insert);
}
pointSizeCBox.setSelectedIndex(insert);
}
代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin
public TwigNamespaceDialog(Project project, TableView<TwigPath> tableView, TwigPath twigPath) {
this(project, tableView);
this.name.setText(twigPath.getNamespace());
this.namespacePath.getTextField().setText(twigPath.getPath());
this.namespaceType.getModel().setSelectedItem(twigPath.getNamespaceType().toString());
this.twigPath = twigPath;
this.setOkState();
}
代码示例来源:origin: dboissier/mongo4idea
@Override
public String valueAt(JComboBox<?> jComboBox, int i) {
ReadPreference readPreference = (ReadPreference) jComboBox.getModel().getElementAt(i);
return readPreference.getName();
}
}
代码示例来源:origin: magefree/mage
DefaultComboBoxModel comboModel = (DefaultComboBoxModel) combo.getModel();
Map<String, String> choiceItems = new HashMap<>(comboModel.getSize());
Map<String, Integer> choiceSorting = new HashMap<>(comboModel.getSize());
代码示例来源:origin: kaikramer/keystore-explorer
@Override
public void itemStateChanged(ItemEvent e) {
loadECNamedCurves((String) jcbECCurveSet.getModel().getSelectedItem());
}
});
代码示例来源:origin: kaikramer/keystore-explorer
/**
* Get the name of the selected curve.
*
* @return The curve name
*/
public String getCurveName() {
return (String) jcbECCurve.getModel().getSelectedItem();
}
代码示例来源:origin: protegeproject/protege
public void setSelectedFormat(OWLDocumentFormat format) {
if (format == null) {
formatComboBox.setSelectedIndex(0);
}
for (int i = 0; i < formatComboBox.getModel().getSize(); i++) {
if (formatComboBox.getModel().getElementAt(i).equals(format)) {
formatComboBox.setSelectedIndex(i);
return;
}
}
}
代码示例来源:origin: robo-code/robocode
public static void setSelected(JComboBox comboBox, String name) {
ComboBoxModel model = comboBox.getModel();
for (int i = 0; i < model.getSize(); i++) {
String itemName = (String) model.getElementAt(i);
if (itemName.equalsIgnoreCase(name)) {
model.setSelectedItem(itemName);
break;
}
}
}
代码示例来源:origin: robo-code/robocode
public static void setSelected(JComboBox comboBox, FontStyle fontStyle) {
ComboBoxModel model = comboBox.getModel();
for (int i = 0; i < model.getSize(); i++) {
String name = (String) model.getElementAt(i);
FontStyle style = FontStyle.fromName(name);
if (style != null && style == fontStyle) {
model.setSelectedItem(name);
break;
}
}
}
内容来源于网络,如有侵权,请联系作者删除!