本文整理汇总了Java中javax.swing.DefaultListModel.get方法的典型用法代码示例。如果您正苦于以下问题:Java DefaultListModel.get方法的具体用法?Java DefaultListModel.get怎么用?Java DefaultListModel.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.DefaultListModel
的用法示例。
在下文中一共展示了DefaultListModel.get方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: collectLibs
import javax.swing.DefaultListModel; //导入方法依赖的package包/类
private void collectLibs(DefaultListModel model, List<String> libs, List<String> jarReferences) {
for (int i = 0; i < model.size(); i++) {
ClassPathSupport.Item item = (ClassPathSupport.Item) model.get(i);
if (item.getType() == ClassPathSupport.Item.TYPE_LIBRARY) {
if (!item.isBroken() && !libs.contains(item.getLibrary().getName())) {
libs.add(item.getLibrary().getName());
}
}
if (item.getType() == ClassPathSupport.Item.TYPE_JAR) {
if (item.getReference() != null && item.getVariableBasedProperty() == null && !jarReferences.contains(item.getReference())) {
//TODO reference is null for not yet persisted items.
// there seems to be no way to generate a reference string without actually
// creating and writing the property..
jarReferences.add(item.getReference());
}
}
}
}
示例2: removeAgent
import javax.swing.DefaultListModel; //导入方法依赖的package包/类
/**
* Removes an agent from the start list corresponding to the current network component .
*
* @param networkComponent the NetworkComponent
*/
public void removeAgent(NetworkComponent networkComponent) {
if (networkComponent == null) {
return;
}
String search4 = networkComponent.getId();
DefaultListModel<AgentClassElement4SimStart> agentList = this.getAgents2Start();
int i = 0;
for (i = 0; i < agentList.size(); i++) {
AgentClassElement4SimStart agentElement = (AgentClassElement4SimStart) agentList.get(i);
if (agentElement.getStartAsName().equals(search4)) {
agentList.remove(i);
break;
}
}
// Shifting the positions of the later components by 1
for (int j = i; j < agentList.size(); j++) {
AgentClassElement4SimStart ac4s = (AgentClassElement4SimStart) agentList.get(j);
ac4s.setPostionNo(ac4s.getPostionNo() - 1);
}
}
示例3: reorderProjects
import javax.swing.DefaultListModel; //导入方法依赖的package包/类
private Boolean reorderProjects(TransferHandler.TransferSupport support) {
JList list = (JList) support.getComponent();
try {
int[] selectedIndices = (int[]) support.getTransferable().getTransferData(INDICES);
DefaultListModel model = (DefaultListModel) list.getModel();
JList.DropLocation dl = (JList.DropLocation) support.getDropLocation();
if (dl.getIndex() != -1) {
for (int selectedIndex : selectedIndices) {
Object value = model.get(selectedIndex);
model.removeElement(value);
model.add(dl.getIndex(), value);
}
return true;
} else {
LOG.warning("Invalid Drop Location");
}
} catch (UnsupportedFlavorException | IOException ex) {
LOG.log(Level.SEVERE, ex.getMessage(), ex);
}
return false;
}
示例4: canEdit
import javax.swing.DefaultListModel; //导入方法依赖的package包/类
public static boolean canEdit( ListSelectionModel selectionModel, DefaultListModel listModel ) {
boolean can = selectionModel.getMinSelectionIndex() == selectionModel.getMaxSelectionIndex()
&& selectionModel.getMinSelectionIndex() != -1;
if (can) {
ClassPathSupport.Item item = (ClassPathSupport.Item) listModel.get(selectionModel.getMinSelectionIndex());
can = item != null && item.canEdit();
}
return can;
}
示例5: updateJars
import javax.swing.DefaultListModel; //导入方法依赖的package包/类
private void updateJars(DefaultListModel model) {
for (int i = 0; i < model.size(); i++) {
ClassPathSupport.Item item = (ClassPathSupport.Item) model.get(i);
if (item.getType() == ClassPathSupport.Item.TYPE_JAR) {
if (item.getReference() != null) {
item.updateJarReference(uiProperties.getProject().getAntProjectHelper());
}
}
}
}
示例6: 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);
}
示例7: 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);
}
示例8: getNetworkModel4Component
import javax.swing.DefaultListModel; //导入方法依赖的package包/类
/**
* This method can be used in order to produce components, by using this
* dialog as factory. Just specify the component by the name given in
* the ComponentTypeSettings dialog.
*
* @param componentName the map node2 component
* @return the NetworkModel for the component
*/
public NetworkModel getNetworkModel4Component(String componentName) {
this.getJListComponentTypes().clearSelection();
// --- Select the right element from the list ---------------
DefaultListModel<ComponentTypeListElement> listModel = this.getListModelComponentTypes();
for (int i = 0; i < listModel.size(); i++) {
ComponentTypeListElement ctsElement = listModel.get(i);
if (ctsElement.getComponentName().equalsIgnoreCase(componentName)) {
this.getJListComponentTypes().setSelectedValue(ctsElement, true);
break;
}
}
return this.localNetworkModel;
}