本文整理了Java中javax.swing.JComboBox.setModel()
方法的一些代码示例,展示了JComboBox.setModel()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JComboBox.setModel()
方法的具体详情如下:
包路径:javax.swing.JComboBox
类名称:JComboBox
方法名:setModel
暂无
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
private void updateAntialiasChoices() {
// maybe in the future will add support for determining this info
// through pbuffer
String[] choices = new String[]{resourceBundle.getString("antialias.disabled"), "2x", "4x", "6x", "8x", "16x"};
antialiasCombo.setModel(new DefaultComboBoxModel(choices));
antialiasCombo.setSelectedItem(choices[Math.min(source.getSamples()/2,5)]);
}
代码示例来源:origin: libgdx/libgdx
shapeCombo = new JComboBox();
shapeCombo.setModel(new DefaultComboBoxModel(SpawnShape.values()));
contentPanel.add(shapeCombo, new GridBagConstraints(1, 1, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE,
new Insets(0, 0, 0, 0), 0, 0));
sideCombo = new JComboBox();
sideCombo.setModel(new DefaultComboBoxModel(SpawnEllipseSide.values()));
contentPanel.add(sideCombo, new GridBagConstraints(5, 1, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE,
new Insets(0, 0, 0, 0), 0, 0));
代码示例来源:origin: nodebox/nodebox
public MenuControl(String nodePath, Port port) {
super(nodePath, port);
setLayout(new FlowLayout(FlowLayout.LEADING, 0, 0));
menuBox = new JComboBox<>();
menuModel = new MenuDataModel(port);
MenuItemRenderer menuItemRenderer = new MenuItemRenderer();
menuBox.setModel(menuModel);
menuBox.setRenderer(menuItemRenderer);
menuBox.putClientProperty("JComponent.sizeVariant", "small");
menuBox.putClientProperty("JComboBox.isPopDown", Boolean.TRUE);
menuBox.setFont(Theme.SMALL_BOLD_FONT);
menuBox.addActionListener(this);
add(menuBox);
setValueForControl(port.getValue());
}
代码示例来源:origin: libgdx/libgdx
shapeCombo = new JComboBox();
shapeCombo.setModel(new DefaultComboBoxModel(SpawnShape.values()));
contentPanel.add(shapeCombo, new GridBagConstraints(1, 1, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE,
new Insets(0, 0, 0, 0), 0, 0));
sideCombo = new JComboBox();
sideCombo.setModel(new DefaultComboBoxModel(SpawnEllipseSide.values()));
contentPanel.add(sideCombo, new GridBagConstraints(5, 1, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE,
new Insets(0, 0, 0, 0), 0, 0));
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
/**
* <code>updateResolutionChoices</code> updates the available resolutions
* list to match the currently selected window mode (fullscreen or
* windowed). It then sets up a list of standard options (if windowed) or
* calls <code>updateDisplayChoices</code> (if fullscreen).
*/
private void updateResolutionChoices() {
if (!fullscreenBox.isSelected()) {
displayResCombo.setModel(new DefaultComboBoxModel(
getWindowedResolutions(windowModes)));
if (displayResCombo.getItemCount() > 0) {
displayResCombo.setSelectedIndex(displayResCombo.getItemCount()-1);
}
colorDepthCombo.setModel(new DefaultComboBoxModel(new String[]{
"24 bpp", "16 bpp"}));
displayFreqCombo.setModel(new DefaultComboBoxModel(
new String[]{resourceBundle.getString("refresh.na")}));
displayFreqCombo.setEnabled(false);
} else {
displayResCombo.setModel(new DefaultComboBoxModel(
getResolutions(modes, Integer.MAX_VALUE, Integer.MAX_VALUE)));
if (displayResCombo.getItemCount() > 0) {
displayResCombo.setSelectedIndex(displayResCombo.getItemCount()-1);
}
displayFreqCombo.setEnabled(true);
updateDisplayChoices();
}
}
代码示例来源:origin: nodebox/nodebox
public FontControl(String nodePath, Port port) {
super(nodePath, port);
setLayout(new FlowLayout(FlowLayout.LEADING, 0, 0));
fontChooser = new JComboBox<>();
fontModel = new FontDataModel();
FontCellRenderer fontCellRenderer = new FontCellRenderer();
fontChooser.setModel(fontModel);
fontChooser.setRenderer(fontCellRenderer);
fontChooser.putClientProperty("JComponent.sizeVariant", "small");
fontChooser.setPreferredSize(new Dimension(150, 22));
fontChooser.putClientProperty("JComboBox.isPopDown", Boolean.TRUE);
fontChooser.addActionListener(this);
fontChooser.setFont(Theme.SMALL_BOLD_FONT);
add(fontChooser);
setValueForControl(port.getValue());
}
代码示例来源:origin: libgdx/libgdx
private void initializeComponents (BillboardParticleBatch renderer) {
alignCombo = new JComboBox();
alignCombo.setModel(new DefaultComboBoxModel(AlignModeWrapper.values()));
alignCombo.setSelectedItem(getAlignModeWrapper(renderer.getAlignMode()));
alignCombo.addActionListener(new ActionListener() {
sortCombo = new JComboBox();
sortCombo.setModel(new DefaultComboBoxModel(SortMode.values()));
sortCombo.setSelectedItem(getSortMode(renderer.getSorter()));
sortCombo.addActionListener(new ActionListener() {
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
colorDepthCombo.setModel(new DefaultComboBoxModel(depths));
colorDepthCombo.setSelectedItem(colorDepth);
displayFreqCombo.setModel(new DefaultComboBoxModel(freqs));
代码示例来源:origin: stackoverflow.com
final JComboBox lstA = new JComboBox();
void bind()
{
String[] arr={"ab","cd","ef"};
// bind arr to lstA
lstA.setModel(new DefaultComboBoxModel<String>(arr));
}
代码示例来源:origin: libgdx/libgdx
private void initializeComponents (BillboardParticleBatch renderer) {
alignCombo = new JComboBox();
alignCombo.setModel(new DefaultComboBoxModel(AlignModeWrapper.values()));
alignCombo.setSelectedItem(getAlignModeWrapper(renderer.getAlignMode()));
alignCombo.addActionListener(new ActionListener() {
sortCombo = new JComboBox();
sortCombo.setModel(new DefaultComboBoxModel(SortMode.values()));
sortCombo.setSelectedItem(getSortMode(renderer.getSorter()));
sortCombo.addActionListener(new ActionListener() {
代码示例来源:origin: stackoverflow.com
final JComboBox genderComboBox = null;
final JComboBox itemComboBox = null;
final DefaultComboBoxModel hisModel = new DefaultComboBoxModel(new String[]{"a", "b", "c"});
final DefaultComboBoxModel herModel = new DefaultComboBoxModel(new String[]{"x", "y", "z"});
genderComboBox.addActionListener (new ActionListener () {
public void actionPerformed(ActionEvent e) {
if ("Men".equals(genderComboBox.getSelectedItem())){
itemComboBox.setModel(hisModel);
} else {
itemComboBox.setModel(herModel);
}
}
});
代码示例来源:origin: stackoverflow.com
YourModel model = new YourModel("path_to_a_file");
JComboBox box1 = new JComboBox();
box1.setModel(model);
JComboBox box2 = new JComboBox();
box2.setModel(model);
代码示例来源:origin: libgdx/libgdx
new Insets(0, 0, 0, 0), 0, 0));
controllerTypeCombo = new JComboBox();
controllerTypeCombo.setModel(new DefaultComboBoxModel(ControllerType.values()));
sideButtons.add(controllerTypeCombo, new GridBagConstraints(0, -1, 1, 1, 0, 0, GridBagConstraints.CENTER,
GridBagConstraints.HORIZONTAL, new Insets(0, 0, 6, 0), 0, 0));
代码示例来源:origin: magefree/mage
/**
* Creates new form PreferencesDialog
*/
public FeedbackDialog(java.awt.Frame parent, boolean modal) {
super(parent, modal);
initComponents();
cbFeedbackType.setModel(new DefaultComboBoxModel(feedbackTypes));
}
代码示例来源:origin: org.zaproxy/zap
private JComboBox<String> getTxtTagAdd() {
if (txtTagAdd == null) {
txtTagAdd = new JComboBox<>();
txtTagAdd.setEditable(true);
tagAddModel = getAllTagsModel();
txtTagAdd.setModel(tagAddModel);
}
return txtTagAdd;
}
代码示例来源:origin: libgdx/libgdx
new Insets(0, 0, 0, 0), 0, 0));
controllerTypeCombo = new JComboBox();
controllerTypeCombo.setModel(new DefaultComboBoxModel(ControllerType.values()));
sideButtons.add(controllerTypeCombo, new GridBagConstraints(0, -1, 1, 1, 0, 0, GridBagConstraints.CENTER,
GridBagConstraints.HORIZONTAL, new Insets(0, 0, 6, 0), 0, 0));
代码示例来源:origin: pentaho/mondrian
private void setCatalogs() {
List<String> v = new ArrayList<String>();
Iterator<JMenuItem> it = schemaWindowMap.values().iterator();
while (it.hasNext()) {
JMenuItem elem = it.next();
v.add(elem.getText());
}
ComboBoxModel cCatalogs =
new DefaultComboBoxModel(new Vector<String>(v));
schemaList.setModel(cCatalogs);
}
代码示例来源:origin: de.alpharogroup/swing-components
@Override
protected void onInitializeComponents()
{
txtFieldName = new JTextField();
lblFieldName = new JLabel();
lblType = new JLabel();
dropDownType = new JComboBox<>();
txtFieldName.setToolTipText("Enter a name");
lblFieldName.setText("Field Name");
lblType.setText("Type");
dropDownType.setModel(newTypeModel());
}
代码示例来源:origin: libgdx/libgdx
GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0));
fontListModel = new DefaultComboBoxModel(
GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames());
fontList = new JList();
glyphPageWidthCombo = new JComboBox(new DefaultComboBoxModel(new Integer[] {new Integer(32), new Integer(64),
new Integer(128), new Integer(256), new Integer(512), new Integer(1024), new Integer(2048)}));
glyphCachePanel.add(glyphPageWidthCombo, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST,
glyphPageHeightCombo = new JComboBox(new DefaultComboBoxModel(new Integer[] {new Integer(32), new Integer(64),
new Integer(128), new Integer(256), new Integer(512), new Integer(1024), new Integer(2048)}));
glyphCachePanel.add(glyphPageHeightCombo, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST,
glyphPageComboModel = new DefaultComboBoxModel();
glyphPageCombo = new JComboBox();
glyphCachePanel.add(glyphPageCombo, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST,
GridBagConstraints.NONE, new Insets(0, 0, 5, 5), 0, 0));
glyphPageCombo.setModel(glyphPageComboModel);
代码示例来源:origin: magefree/mage
public void init(int playerNum) {
cbPlayerType.setModel(new DefaultComboBoxModel(SessionHandler.getPlayerTypes()));
this.lblPlayerNum.setText("Player " + playerNum);
}
内容来源于网络,如有侵权,请联系作者删除!