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


Java JList.getSelectedIndices方法代码示例

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


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

示例1: ListParameter

import javax.swing.JList; //导入方法依赖的package包/类
public ListParameter(JList list, String parameter, String encoding) {
    super(parameter, encoding);
    this.list = list;
    list.setModel(new DefaultListModel());
    list.addListSelectionListener(new ListSelectionListener(){
        @Override
        public void valueChanged(ListSelectionEvent e) {
            int[] s = ListParameter.this.list.getSelectedIndices();
            if(e.getValueIsAdjusting()) {
                return;
            }
            fireStateChanged();
        };
    });
    original = list.getSelectedIndices();
    fireStateChanged();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:QueryParameter.java

示例2: exportString

import javax.swing.JList; //导入方法依赖的package包/类
protected String exportString(JComponent c) {
    JList list = (JList) c;
    indices = list.getSelectedIndices();
    @SuppressWarnings("deprecation")
    Object[] values = list.getSelectedValues();

    StringBuffer buff = new StringBuffer();

    for (int i = 0; i < values.length; i++) {
        Object val = values[i];
        buff.append(val == null ? "" : val.toString());
        if (i != values.length - 1) {
            buff.append("\n");
        }
    }

    return buff.toString();
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:19,代码来源:ListTransferHandler.java

示例3: getSelectedTables

import javax.swing.JList; //导入方法依赖的package包/类
public static Set<Table> getSelectedTables(JList list, boolean enabledOnly) {
    Set<Table> result = new HashSet<Table>();

    int[] selected = list.getSelectedIndices();
    for (int i = 0; i < selected.length; i++) {
        Table table = (Table)list.getModel().getElementAt(selected[i]);
        if(enabledOnly){
            if(!list.getCellRenderer().getListCellRendererComponent(list, table, selected[i], false, false).isEnabled())continue;
        }
        result.add(table);
    }

    return result;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:TableUISupport.java

示例4: createTransferable

import javax.swing.JList; //导入方法依赖的package包/类
@Override
public Transferable createTransferable(JComponent comp) {
    final JList list = (JList)comp;
    indices = list.getSelectedIndices();
    if (indices.length == 0) {
        return null;
    }
    return new FileListTransferable(safeCopy(list.getSelectedValues(),File.class));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:FolderList.java

示例5: javaCompletionExcluderRemoveButtonActionPerformed

import javax.swing.JList; //导入方法依赖的package包/类
private void javaCompletionExcluderRemoveButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_javaCompletionExcluderRemoveButtonActionPerformed
    JList list = getSelectedExcluderList();
    int[] rows = list.getSelectedIndices();
    DefaultListModel model = (DefaultListModel) list.getModel();
    // remove rows in descending order: row numbers change when a row is removed
    for (int row = rows.length - 1; row >= 0; row--) {
        model.remove(rows[row]);
    }
    updateExcluder(list);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:CodeCompletionPanel.java

示例6: getSelectionText

import javax.swing.JList; //导入方法依赖的package包/类
public static String getSelectionText(JList list) {
    List<Properties> pa = new ArrayList<Properties>();
    int[] selectedIndices = list.getSelectedIndices();
    for (int index : selectedIndices) {
        Properties p = new Properties();
        p.setProperty("listText", JListItemJavaElement.getText(list, index));
        pa.add(p);
    }
    return PropertyHelper.toString(pa.toArray(new Properties[pa.size()]), new String[] { "listText" });
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:11,代码来源:JListJavaElement.java

示例7: createTransferable

import javax.swing.JList; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected Transferable createTransferable(JComponent c) {
    JList list = (JList)c;
    DefaultListModel model = (DefaultListModel)list.getModel();
    List<TradeRouteStop> stops = new ArrayList<>();
    for (int index : list.getSelectedIndices()) {
        stops.add((TradeRouteStop)model.get(index));
    }
    return new StopListTransferable(stops);
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:14,代码来源:TradeRouteInputPanel.java

示例8: createTransferable

import javax.swing.JList; //导入方法依赖的package包/类
@Override
protected Transferable createTransferable(JComponent c) {
    JList list = (JList) c;
    return new JListTransferable(list.getSelectedIndices());
}
 
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:6,代码来源:InjectScript.java


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