本文整理匯總了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
}
}