当前位置: 首页>>代码示例>>Java>>正文


Java DefaultListModel.addElement方法代码示例

本文整理汇总了Java中javax.swing.DefaultListModel.addElement方法的典型用法代码示例。如果您正苦于以下问题:Java DefaultListModel.addElement方法的具体用法?Java DefaultListModel.addElement怎么用?Java DefaultListModel.addElement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.DefaultListModel的用法示例。


在下文中一共展示了DefaultListModel.addElement方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setVerticalLineSelected

import javax.swing.DefaultListModel; //导入方法依赖的package包/类
/**
 * Vertical lines selected.
 */
private void setVerticalLineSelected() {
	// show horizontal lines
	rangeAxisSelectionCombobox.setEnabled(false);
	linesList.clearSelection();

	// get all horizontal lines and display them
	DefaultListModel<AxisParallelLineConfiguration> model = new DefaultListModel<AxisParallelLineConfiguration>();
	List<AxisParallelLineConfiguration> domainLines = engine.getPlotInstance().getMasterPlotConfiguration()
			.getDomainConfigManager().getCrosshairLines().getLines();
	for (int i = 0; i < domainLines.size(); i++) {
		AxisParallelLineConfiguration line = domainLines.get(i);
		model.addElement(line);
	}

	linesList.setModel(model);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:20,代码来源:ManageParallelLinesDialog.java

示例2: show

import javax.swing.DefaultListModel; //导入方法依赖的package包/类
public boolean show(File[] files) {
    Arrays.sort(files);
    DefaultListModel m = new DefaultListModel();
    for (File file : files) {
        m.addElement(file);
    }
    filesList.setModel(m);
    preselectFile(files);

    Dialog dialog = DialogDisplayer.getDefault().createDialog(dialogDescriptor);
    dialog.getAccessibleContext().setAccessibleDescription(title);                     // NOI18N

    dialogDescriptor.setHelpCtx(helpCtx);
    dialog.setVisible(true);
    boolean ret = dialogDescriptor.getValue() == okButton;
    if(ret) {
        saveSelectedFile(files);
    }
    return ret;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:FileSelector.java

示例3: populateAccessory

import javax.swing.DefaultListModel; //导入方法依赖的package包/类
/**
 * Set up GUI fields according to the requested project.
 * @param project a subproject, or null
 */
private void populateAccessory( Project project ) {
    
    DefaultListModel model = (DefaultListModel)jListArtifacts.getModel();
    model.clear();
    jTextFieldName.setText(project == null ? "" : ProjectUtils.getInformation(project).getDisplayName()); //NOI18N
    
    if ( project != null ) {
        
        List<AntArtifact> artifacts = new ArrayList<AntArtifact>();
        for (int i=0; i<artifactTypes.length; i++) {
            artifacts.addAll (Arrays.asList(AntArtifactQuery.findArtifactsByType(project, artifactTypes[i])));
        }
        
        for(AntArtifact artifact : artifacts) {
            URI uris[] = artifact.getArtifactLocations();
            for( int y = 0; y < uris.length; y++ ) {
                model.addElement( new AntArtifactItem(artifact, uris[y]));
            }
        }
        jListArtifacts.setSelectionInterval(0, model.size());
    }
    
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:28,代码来源:AntArtifactChooser.java

示例4: createSyntaxPanel

import javax.swing.DefaultListModel; //导入方法依赖的package包/类
private JComponent createSyntaxPanel() {
    final JList<String> list = new JList<>();
    DefaultListModel<String> model = new DefaultListModel<>();
    for (Map.Entry<String,String> entry : this.docMap.entrySet()) {
        model.addElement(entry.getKey());
    }
    list.setModel(model);
    list.setCellRenderer(new MyCellRenderer(this.docMap));
    list.addMouseListener(new DismissDelayer(list));
    list.setSelectionModel(new DefaultListSelectionModel() {
        @Override
        public void setSelectionInterval(int index0, int index1) {
            super.setSelectionInterval(-1, -1);
        }
    });
    JPanel result = new JPanel(new BorderLayout());
    result.setBorder(BorderFactory.createEmptyBorder(0, 6, 0, 0));
    result.add(new JLabel("<html><b>Syntax:"), BorderLayout.NORTH);
    result.add(new JScrollPane(list), BorderLayout.CENTER);
    return result;
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:22,代码来源:StringDialog.java

示例5: updateLocales

import javax.swing.DefaultListModel; //导入方法依赖的package包/类
private void updateLocales() {
    DefaultListModel model = new DefaultListModel();
    List<Locale> locales = new ArrayList<Locale>(Arrays.asList(DictionaryProviderImpl.getInstalledDictionariesLocales()));

    for (DictionaryDescription desc : addedDictionaries) {
        locales.add(desc.getLocale());
    }
    
    locales.removeAll(removedDictionaries);

    for (Locale l : locales) {
        model.addElement(l);
    }
    
    installedLocalesList.setModel(model);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:SpellcheckerOptionsPanel.java

示例6: setupFieldsFrame

import javax.swing.DefaultListModel; //导入方法依赖的package包/类
private void setupFieldsFrame() {
	frameFields = new JInternalFrame("Fields");
	frameFields.setResizable(true);
	frameFields.setIconifiable(true);
	frameFields.setBounds(frameClass.getWidth() + 11, 11, 180, 140);
	frameFields.setVisible(true);
	frameFields.setLayout(new BorderLayout());
	fields = new JList<>();
	fields.setCellRenderer(new MemberNodeRenderer());
	fields.addMouseListener(new MemberNodeClickListener(this, node, fields));
	DefaultListModel<FieldNode> model = new DefaultListModel<>();
	for (FieldNode fn : node.fields) {
		model.addElement(fn);
	}
	if (node.fields.size() == 0) {
		fields.setVisibleRowCount(5);
		fields.setPrototypeCellValue(new FieldNode(0, "Add_A_Field", "Ljava/lang/Object;", null, null));
	}
	fields.setModel(model);
	frameFields.add(new JScrollPane(fields), BorderLayout.CENTER);
	frameFields.pack();
}
 
开发者ID:Col-E,项目名称:Recaf,代码行数:23,代码来源:ClassDisplayPanel.java

示例7: setHorizontalLineSelected

import javax.swing.DefaultListModel; //导入方法依赖的package包/类
/**
 * Horizontal lines selected.
 */
private void setHorizontalLineSelected() {
	// show horizontal lines
	rangeAxisSelectionCombobox.setEnabled(true);
	linesList.clearSelection();

	// get all vertical lines of the selected RangeAxisConfig and display them
	RangeAxisConfig selectedConfig = (RangeAxisConfig) rangeAxisSelectionCombobox.getSelectedItem();
	DefaultListModel<AxisParallelLineConfiguration> model = new DefaultListModel<AxisParallelLineConfiguration>();
	if (selectedConfig != null) {
		List<AxisParallelLineConfiguration> rangeAxisLines = selectedConfig.getCrossHairLines().getLines();
		for (int i = 0; i < rangeAxisLines.size(); i++) {
			AxisParallelLineConfiguration line = rangeAxisLines.get(i);
			model.addElement(line);
		}
	}

	linesList.setModel(model);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:22,代码来源:ManageParallelLinesDialog.java

示例8: PluginDialog

import javax.swing.DefaultListModel; //导入方法依赖的package包/类
public PluginDialog()
{
	listModel = new DefaultListModel();

	list = new JList();
	list.setModel(listModel);
	list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

	for( String name : plugins.keySet() )
	{
		listModel.addElement(name);
	}

	setLayout(new BorderLayout());
	add(new JScrollPane(list));
}
 
开发者ID:equella,项目名称:Equella,代码行数:17,代码来源:SearchTool.java

示例9: PopuleLista

import javax.swing.DefaultListModel; //导入方法依赖的package包/类
private void PopuleLista() {
    List<Constraint> uni = getSelecionada().getConstraints().stream().filter(c -> c.getTipo() == Constraint.CONSTRAINT_TIPO.tpUNIQUE).collect(Collectors.toList());
    DefaultListModel lst = new DefaultListModel();
    int t = 1;
    for (Constraint contr : uni) {
        lst.addElement(Integer.toString(t++) + " - " + contr.getNomeFormatado());
    }
    Listador.setModel(lst);
    if (lst.isEmpty()) {
        SetSelConstr(null);
    } else {
        int idx = (getSelecionada().getConstraintSelecionado() == null) ? 0 : uni.indexOf(getSelecionada().getConstraintSelecionado());
        Listador.setSelectedIndex(idx);
    }
}
 
开发者ID:chcandido,项目名称:brModelo,代码行数:16,代码来源:EditorDeIrUnique.java

示例10: initTags

import javax.swing.DefaultListModel; //导入方法依赖的package包/类
private void initTags (String preselectedTag) {
    DefaultListModel model = new DefaultListModel();
    GitTag selected = null;
    GitTag[] tagArray = tags.values().toArray(new GitTag[tags.values().size()]);
    Arrays.sort(tagArray, new Comparator<GitTag>() {
        @Override
        public int compare (GitTag o1, GitTag o2) {
            return o1.getTagName().compareTo(o2.getTagName());
        }
    });
    for (GitTag tag : tagArray) {
        if (tag.getTagName().equals(preselectedTag)) {
            selected = tag;
        }
        model.addElement(tag);
    }
    panel.lstTags.setModel(model);
    if (selected != null) {
        panel.lstTags.setSelectedValue(selected, true);
    }
    if (quickSearch != null) {
        quickSearch.detach();
        quickSearch = null;
    }
    if (!model.isEmpty()) {
        quickSearch = GitUtils.attachQuickSearch(Arrays.asList(tagArray), panel.tagsPanel, panel.lstTags, model, new GitUtils.SearchCallback<GitTag>() {

            @Override
            public boolean contains (GitTag item, String needle) {
                return item.getTagName().toLowerCase().contains(needle.toLowerCase());
            }
        });
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:35,代码来源:ManageTags.java

示例11: setParameterValues

import javax.swing.DefaultListModel; //导入方法依赖的package包/类
public void setParameterValues(ParameterValue[] values) {
    DefaultListModel m = new DefaultListModel();
    for (ParameterValue pv : values) {
        m.addElement(pv);
    }
    list.setModel(m);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:QueryParameter.java

示例12: createListModel

import javax.swing.DefaultListModel; //导入方法依赖的package包/类
private ListModel createListModel() {
    DefaultListModel dlm = new DefaultListModel();
    
    for (Candidate cand: toShow) {
        dlm.addElement(cand);
    }
    
    return dlm;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:MethodCandidateChooser.java

示例13: LocaleSelector

import javax.swing.DefaultListModel; //导入方法依赖的package包/类
LocaleSelector(Locale[] locales) {
	setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
	DefaultListModel<Object> model = new DefaultListModel<Object>();
	items = new LocaleOption[locales.length];
	for (int i = 0; i < locales.length; i++) {
		items[i] = new LocaleOption(locales[i]);
		model.addElement(items[i]);
	}
	setModel(model);
	setVisibleRowCount(Math.min(items.length, 8));
	LocaleManager.addLocaleListener(this);
	localeChanged();
	addListSelectionListener(this);
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:15,代码来源:LocaleSelector.java

示例14: setContents

import javax.swing.DefaultListModel; //导入方法依赖的package包/类
private void setContents(List<String> contents) {
	DefaultListModel model = (DefaultListModel)getModel();
	model.clear();
	for (String str : contents) {
		model.addElement(new LabelValuePair(str));
	}
	setVisibleRowCount(Math.min(model.getSize(), 8));
}
 
开发者ID:Thecarisma,项目名称:powertext,代码行数:9,代码来源:ClipboardHistoryPopup.java

示例15: setFiles

import javax.swing.DefaultListModel; //导入方法依赖的package包/类
public void setFiles (File[] files) {
    DefaultListModel model = ((DefaultListModel)this.roots.getModel());
    model.clear();
    for (int i=0; i<files.length; i++) {
        model.addElement (files[i]);
    }
    if (files.length>0) {
        this.roots.setSelectedIndex(0);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:FolderList.java


注:本文中的javax.swing.DefaultListModel.addElement方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。