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


Java DefaultListModel.getElementAt方法代码示例

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


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

示例1: package

import javax.swing.DefaultListModel; //导入方法依赖的package包/类
@Messages("MSG_PublicPackagesAddedFmt=Exported {0} public package(s).\nList of public packages can be further customized on \"API Versioning\" tab.")
private void exportButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exportButtonActionPerformed
    int[] selectedIndices = emListComp.getSelectedIndices();
    List<File> jars = new ArrayList<File>();
    DefaultListModel listModel = getProperties().getWrappedJarsListModel();
    for (int i : selectedIndices) {
        Item item = (Item) listModel.getElementAt(i);
        if (item.getType() == Item.TYPE_JAR) {
            jars.add(item.getResolvedFile());
        }
    }
    if (jars.size() > 0) {
        int dif = getProperties().exportPackagesFromJars(jars);
        NotifyDescriptor.Message msg = new NotifyDescriptor.Message(
                MSG_PublicPackagesAddedFmt(dif));
        DialogDisplayer.getDefault().notify(msg);
        for (File jar : jars) {
            isJarExportedMap.put(jar, Boolean.TRUE);
        }
    }
    exportButton.setEnabled(false);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:23,代码来源:CustomizerLibraries.java

示例2: edit

import javax.swing.DefaultListModel; //导入方法依赖的package包/类
public static void edit(DefaultListModel listModel, int[] selectedIndices, AntProjectHelper helper) {
    ClassPathSupport.Item item = (ClassPathSupport.Item) listModel.getElementAt(selectedIndices[0]);
    if (item.getType() == ClassPathSupport.Item.TYPE_JAR) {
        EditJarSupport.Item eji = new EditJarSupport.Item();
        eji.setJarFile(item.getVariableBasedProperty() != null ? item.getVariableBasedProperty() : item.getFilePath());
        eji.setSourceFile(item.getSourceFilePath());
        eji.setJavadocFile(item.getJavadocFilePath());
        eji = EditJarSupport.showEditDialog(helper, eji);
        if (eji != null) {
            item.setJavadocFilePath(eji.getJavadocFile());
            item.setSourceFilePath(eji.getSourceFile());
        }
    }
    if (item.getType() == ClassPathSupport.Item.TYPE_LIBRARY) {
        if (item.getLibrary() != null) {
            LibrariesCustomizer.showSingleLibraryCustomizer(item.getLibrary());
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:ClassPathUiSupport.java

示例3: updateExcluder

import javax.swing.DefaultListModel; //导入方法依赖的package包/类
private void updateExcluder(JList list) {
    DefaultListModel model = (DefaultListModel) list.getModel();
    StringBuilder builder = new StringBuilder();
    for (int i = 0 ; i < model.size() ; i++) {
        String entry = (String) model.getElementAt(i);
        if (builder.length() > 0) {
            builder.append(","); //NOI18N
        }
        builder.append(entry);
    }
    String pref;
    if (list == javaCompletionExcludeJlist)
        pref = JAVA_COMPLETION_BLACKLIST;
    else if (list == javaCompletionIncludeJlist)
        pref = JAVA_COMPLETION_WHITELIST;
    else
        throw new RuntimeException(list.getName());

    preferences.put(pref, builder.toString());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:CodeCompletionPanel.java

示例4: getNewComboBoxModelFilter

import javax.swing.DefaultListModel; //导入方法依赖的package包/类
/**
 * 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;
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:24,代码来源:AddComponentDialog.java

示例5: jAddAllOfficesButtonAction

import javax.swing.DefaultListModel; //导入方法依赖的package包/类
private void jAddAllOfficesButtonAction(java.awt.event.ActionEvent evt) {
    DefaultListModel availableModel = (DefaultListModel) jOfficeAvailable.getModel();
    DefaultListModel selectedModel = (DefaultListModel) jOfficeSelected.getModel();

    for (int i = 0; i < availableModel.getSize(); i++) {
        QOffice officeToAdd = (QOffice) availableModel.getElementAt(i);

        if (!selectedModel.contains(officeToAdd)) {
            selectedModel.addElement(officeToAdd);
            officesToAdd.add(officeToAdd);
        }
    }

    //Clear the remove list, since we're adding all of the offices
    officesToRemove = new LinkedList<QOffice>();
}
 
开发者ID:bcgov,项目名称:sbc-qsystem,代码行数:17,代码来源:FServiceChangeDialod.java

示例6: getIndex

import javax.swing.DefaultListModel; //导入方法依赖的package包/类
private int getIndex(DefaultListModel model, String s) {
    for (int i = 0; i < model.getSize(); i++) {
        ListValue e = (ListValue) model.getElementAt(i);
        if(e.value.equals(s)) {
            return i;
        }
    }
    return -1;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:ListValuePicker.java

示例7: updateEnabled

import javax.swing.DefaultListModel; //导入方法依赖的package包/类
private void updateEnabled() {
    // add and OK is disabled in waitmodel
    // TODO C.P how to disable OK?
    boolean okEnabled = ! UIUtil.isWaitModel(dependencyList.getModel());
    // if there is no selection disable edit/remove buttons
    boolean enabled = dependencyList.getModel().getSize() > 0 
            && okEnabled
            && getProperties().isActivePlatformValid()
            && dependencyList.getSelectedIndex() != -1;
    editDepButton.setEnabled(enabled);
    removeDepButton.setEnabled(enabled);
    addDepButton.setEnabled(okEnabled && getProperties().isActivePlatformValid());
    boolean javaEnabled = getProperties().isNetBeansOrg() ||
            (getProperties().isStandalone() &&
            /* #71631 */ ((NbPlatform) platformValue.getSelectedItem()).getHarnessVersion().compareTo(HarnessVersion.V50u1) >= 0);
    javaPlatformCombo.setEnabled(javaEnabled);
    javaPlatformButton.setEnabled(javaEnabled);

    int[] selectedIndices = emListComp.getSelectedIndices();
    DefaultListModel listModel = getProperties().getWrappedJarsListModel();
    boolean exportEnabled = false;
    for (int i : selectedIndices) {
        Item item = (Item) listModel.getElementAt(i);
        if (item.getType() == Item.TYPE_JAR) {
            final Boolean value = isJarExportedMap.get(item.getResolvedFile());
            // value == null means not yet refreshed map, we can just allow export in such case
            exportEnabled |= (value == null || ! value.booleanValue());
            if (exportEnabled) {
                break;
            }
        }
    }
    exportButton.setEnabled(exportEnabled);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:35,代码来源:CustomizerLibraries.java

示例8: copyButtonActionPerformed

import javax.swing.DefaultListModel; //导入方法依赖的package包/类
private void copyButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_copyButtonActionPerformed
        int index = formattersList.getSelectedIndex();
        if (index < 0) return ;
        DefaultListModel model = (DefaultListModel) formattersList.getModel();
        VariablesFormatter f = (VariablesFormatter) model.getElementAt(index);
        VariablesFormatter f2 = f.clone();

        Set<String> formatterNames = getFormatterNames();
        String name = f2.getName();
        while (formatterNames.contains(name)) {
            boolean isCopied = name.contains(COPY1) && name.endsWith(COPY2);
            int nc = 0;
            if (isCopied) {
                int i1 = name.lastIndexOf(COPY1) + COPY1.length();
                int i2 = name.length() - COPY2.length();
                if (i1 == i2) {
                   nc = 1;
                } else {
                    String ncs = name.substring(i1, i2);
                    try {
                        nc = Integer.parseInt(ncs);
                    } catch (NumberFormatException nfex) {
                        isCopied = false;
                    }
                }
            }
            if (isCopied) {
                nc++;
                name = name.substring(0, name.lastIndexOf(COPY1)) + COPY1 + nc + COPY2;
            } else {
                name = name + COPY1 + COPY2;
            }
        }
        f2.setName(name);
        ((DefaultListModel) formattersList.getModel()).insertElementAt(f2, index);
        formattersList.setSelectedValue(f2, true);
        
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:39,代码来源:CategoryPanelFormatters.java

示例9: toTreeModel

import javax.swing.DefaultListModel; //导入方法依赖的package包/类
private static DefaultTreeModel toTreeModel(final DefaultListModel lm, final String rootName) {
    DefaultMutableTreeNode root = new DefaultMutableTreeNode(rootName);
    for (int i = 0; i < lm.getSize(); i++) {
        Object obj = lm.getElementAt(i);
        if (obj instanceof ClassPathSupport.Item) {
            root.add(toTreeNode(obj));
        }
    }
    return new DefaultTreeModel(root);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:PathsCustomizer.java

示例10: javaCompletionExcluderEditButtonActionPerformed

import javax.swing.DefaultListModel; //导入方法依赖的package包/类
private void javaCompletionExcluderEditButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_javaCompletionExcluderEditButtonActionPerformed
    JList list = getSelectedExcluderList();
    int index = list.getSelectedIndex();
    if (index == -1)
    return;
    DefaultListModel model = (DefaultListModel) list.getModel();
    javaExcluderEditing = (String) model.getElementAt(index);
    openExcluderEditor();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:CodeCompletionPanel.java

示例11: updateAllLists

import javax.swing.DefaultListModel; //导入方法依赖的package包/类
/**
 * Update all the lists and buttons, using
 *      {@link #updateBuildingList()} and
 *      {@link #updateUnitList()}
 */
private void updateAllLists() {
    final DefaultListModel<BuildableType> current
        = (DefaultListModel<BuildableType>)this.buildQueueList.getModel();

    this.featureContainer.clear();
    for (Enumeration<BuildableType> e = current.elements();
         e.hasMoreElements();) {
        BuildableType type = e.nextElement();
        if (getMinimumIndex(type) >= 0) {
            featureContainer.addFeatures(type);
        } else {
            current.removeElement(type);
        }
    }
    // ATTENTION: buildings must be updated first, since units
    // might depend on the build ability of an unbuildable
    // building
    updateBuildingList();
    updateUnitList();

    // Update the buy button
    final boolean pay = getSpecification()
        .getBoolean(GameOptions.PAY_FOR_BUILDING);
    BuildableType bt = (current.getSize() <= 0) ? null
        : current.getElementAt(0);
    this.buyBuildable.setEnabled(bt != null && pay
        && this.colony.canPayToFinishBuilding(bt));
    this.setBuyLabel(bt);

    // Update the construction panel
    if (current.getSize() > 0) {
        this.constructionPanel.update(current.getElementAt(0));
    } else if (current.getSize() == 0) {
        this.constructionPanel.update(); // generates Building: Nothing
    }
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:42,代码来源:BuildQueuePanel.java

示例12: jRemoveAllOfficesButtonAction

import javax.swing.DefaultListModel; //导入方法依赖的package包/类
private void jRemoveAllOfficesButtonAction(java.awt.event.ActionEvent evt) {
    DefaultListModel selectedModel = (DefaultListModel) jOfficeSelected.getModel();

    while (selectedModel.getSize() > 0) {
        QOffice officeToRemove = (QOffice) selectedModel.getElementAt(0);
        selectedModel.removeElement(officeToRemove);
        officesToRemove.add(officeToRemove);
    }

    //Clear the add list, since we're removing all of the offices
    officesToAdd = new LinkedList<QOffice>();
}
 
开发者ID:bcgov,项目名称:sbc-qsystem,代码行数:13,代码来源:FServiceChangeDialod.java

示例13: editButtonActionPerformed

import javax.swing.DefaultListModel; //导入方法依赖的package包/类
private void editButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editButtonActionPerformed
    int index = formattersList.getSelectedIndex();
    if (index < 0) return ;
    DefaultListModel model = (DefaultListModel) formattersList.getModel();
    VariablesFormatter f = (VariablesFormatter) model.getElementAt(index);

    VariableFormatterEditPanel fPanel = new VariableFormatterEditPanel();
    fPanel.load(f);

    Set<String> formatterNames = getFormatterNames();
    formatterNames.remove(f.getName());
    fPanel.setFormatterNames(formatterNames);

    DialogDescriptor formatterEditDescriptor = new DialogDescriptor(
            fPanel,
            NbBundle.getMessage(CategoryPanelFormatters.class, "TTL_EditFormatter"),
            true,
            NotifyDescriptor.OK_CANCEL_OPTION, NotifyDescriptor.OK_OPTION,
            null);
    NotificationLineSupport notificationSupport = formatterEditDescriptor.createNotificationLineSupport();
    fPanel.setValidityObjects(formatterEditDescriptor, notificationSupport, true);
    //formatterEditDescriptor.setValid(false);
    Dialog dlg = DialogDisplayer.getDefault().createDialog(formatterEditDescriptor);
    Properties p = Properties.getDefault().getProperties("debugger.options.JPDA"); // NOI18N
    int w = p.getInt("VariableFormatters_AddEdit_WIDTH", -1);                      // NOI18N
    int h = p.getInt("VariableFormatters_AddEdit_HEIGHT", -1);                     // NOI18N
    if (w > 0 && h > 0) {
        dlg.setSize(new Dimension(w, h));
    }
    dlg.setVisible(true);
    Dimension dim = dlg.getSize();
    p.setInt("VariableFormatters_AddEdit_WIDTH", dim.width);                       // NOI18N
    p.setInt("VariableFormatters_AddEdit_HEIGHT", dim.height);                     // NOI18N
    if (NotifyDescriptor.OK_OPTION.equals(formatterEditDescriptor.getValue())) {
        fPanel.store(f);
        checkBoxComponents.put(f, new JCheckBox(f.getName(), f.isEnabled()));
        ((DefaultListModel) formattersList.getModel()).setElementAt(f, index);
        //formattersList.repaint();
        formattersList.setSelectedValue(f, true);
        loadSelectedFormatter(f);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:43,代码来源:CategoryPanelFormatters.java

示例14: scanPassive

import javax.swing.DefaultListModel; //导入方法依赖的package包/类
private List<IScanIssue> scanPassive( byte[] text, int offSet, IHttpRequestResponse baseRequestResponse, String location)
{
    DefaultListModel<String> model = comp.getModel();
    List<IScanIssue> issues = new ArrayList<>();

    if (model != null)
    {
        for (int i = 0; i < model.getSize(); i++)
        {
            String term = model.getElementAt(i);
            Pattern pattern = Pattern.compile(term);
            Matcher matcher = pattern.matcher(new String(text));
            List <ScanMatch>matches = new ArrayList<>(); //Possible places for search results

            while (matcher.find())
            {
                matches.add(new ScanMatch(matcher.group(), matcher.start() + offSet, matcher.end() + offSet, ""));
            }
            
                  if (matches.size() > 0)
            {            
                ScanMatch [] arrMatches = new ScanMatch[matches.size()];
                matches.toArray(arrMatches);
                Arrays.sort(arrMatches);

                List <int[]> startStop = new ArrayList<>();  //List of start and stop positions for items

                //Build the issue if there are matches
                StringBuilder description = new StringBuilder();
                description.append("One or more of your search terms was found from Scan Items.<br/><br/>");
                description.append("<b>Parameter details</b><br/><br/>");

                description.append("The following search terms have been found in the response:<br>");        
                description.append("<ul>");            
                for (ScanMatch match: arrMatches)
                {
                    startStop.add(new int[] { match.getStart(), match.getEnd() });
                    description.append("<li>");
                    description.append(match.getMatch());
                    description.append("</li>");
                }
                description.append("</ul>");    

                //Add the issue
                issues.add(new ScanIssue(baseRequestResponse.getHttpService(), this.helpers.analyzeRequest(baseRequestResponse).getUrl(), new IHttpRequestResponse[] { this.callbacks.applyMarkers(baseRequestResponse, null, startStop) }, "Search Term \"" + term + "\" found in the " + location, description.toString(), "Information", "Certain"));
            }

        }
    }
    return issues;
}
 
开发者ID:sampsonc,项目名称:SearchPlusPlus,代码行数:52,代码来源:BurpExtender.java


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