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


Java DefaultListModel.set方法代码示例

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


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

示例1: moveUpButtonActionPerformed

import javax.swing.DefaultListModel; //导入方法依赖的package包/类
private void moveUpButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_moveUpButtonActionPerformed
    int[] indexes = displayedGroupsList.getSelectedIndices();
    DefaultListModel displayedModel = (DefaultListModel) displayedGroupsList.getModel();
    for (int index : indexes) {
        Object down = displayedModel.get(index - 1);
        Object up = displayedModel.get(index);
        displayedModel.set(index, down);
        displayedModel.set(index - 1, up);
    }
    for (int i = 0; i < indexes.length; i++) {
        indexes[i]--;
    }
    displayedGroupsList.setSelectedIndices(indexes);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:BreakpointNestedGroupsDialog.java

示例2: moveDownButtonActionPerformed

import javax.swing.DefaultListModel; //导入方法依赖的package包/类
private void moveDownButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_moveDownButtonActionPerformed
    int[] indexes = displayedGroupsList.getSelectedIndices();
    DefaultListModel displayedModel = (DefaultListModel) displayedGroupsList.getModel();
    for (int index : indexes) {
        Object down = displayedModel.get(index);
        Object up = displayedModel.get(index + 1);
        displayedModel.set(index + 1, down);
        displayedModel.set(index, up);
    }
    for (int i = 0; i < indexes.length; i++) {
        indexes[i]++;
    }
    displayedGroupsList.setSelectedIndices(indexes);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:BreakpointNestedGroupsDialog.java

示例3: setModel

import javax.swing.DefaultListModel; //导入方法依赖的package包/类
/**
 * Set the content of the model to the list.
 * @param model 
 * @param list items that will be inserted into the model.
 */
private void setModel(DefaultListModel model, List<T> list) {
    model.setSize(list.size() + 1);
    model.set(0, getNewItemLabel());
    for (int i = 0; i < list.size(); ++i) {
        model.set(i + 1, list.get(i));
    }
}
 
开发者ID:kefik,项目名称:Pogamut3,代码行数:13,代码来源:Explorer.java

示例4: importData

import javax.swing.DefaultListModel; //导入方法依赖的package包/类
@Override public boolean importData(TransferHandler.TransferSupport info) {
    if (!info.isDrop()) {
        return false;
    }

    JList list = (JList) info.getComponent();
    DefaultListModel listModel = (DefaultListModel) list.getModel();
    JList.DropLocation dl = (JList.DropLocation) info.getDropLocation();
    int index = dl.getIndex();
    boolean insert = dl.isInsert();

    // Get the string that is being dropped.
    Transferable t = info.getTransferable();
    String data;
    try {
        data = (String) t.getTransferData(DataFlavor.stringFlavor);
    } catch (Exception e) {
        return false;
    }

    // Perform the actual import.
    if (insert) {
        listModel.add(index, data);
    } else {
        listModel.set(index, data);
    }
    return true;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:29,代码来源:ListTransferHandler.java


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