當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。