本文整理汇总了Java中javax.swing.DefaultListModel.elements方法的典型用法代码示例。如果您正苦于以下问题:Java DefaultListModel.elements方法的具体用法?Java DefaultListModel.elements怎么用?Java DefaultListModel.elements使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.DefaultListModel
的用法示例。
在下文中一共展示了DefaultListModel.elements方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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
}
}