コード例 #1
0
 @Override
 protected void save() {
   Settings.lock("Stockpile (Items Dialog)"); // Lock for Stockpile (Items Dialog)
   if (stockpileItem != null) { // EDIT
     if (itemExist()) { // EDIT + UPDATING (Editing to an existing item)
       StockpileItem existingItem = getExistingItem();
       existingItem.getStockpile().remove(existingItem);
       program.getStockpileTool().removeItem(existingItem);
     }
     stockpileItem.update(getStockpileItem());
   } else if (itemExist()) { // UPDATING (Adding an existing item)
     stockpileItem = getExistingItem();
     stockpileItem.update(getStockpileItem());
   } else { // ADD
     stockpileItem = getStockpileItem();
     stockpile.add(stockpileItem);
   }
   Settings.unlock("Stockpile (Items Dialog)"); // Unlock for Stockpile (Items Dialog)
   program.saveSettings("Stockpile (Items Dialog)"); // Save Stockpile (Items Dialog)
   super.setVisible(false);
 }
コード例 #2
0
 private void show() {
   autoValidate();
   autoSet();
   super.setVisible(true);
 }