Changeset 4014


Ignore:
Timestamp:
05/05/09 13:37:05 (4 years ago)
Author:
awwalter
Message:

alternative implementations for addItems and setUnits produces same results

File:
1 edited

Legend:

Unmodified
Added
Removed
  • PP/branches/leap-second-dev-branch/jungle/src/org/trinet/util/graphics/DeltaTimePanel.java

    r3451 r4014  
    8787     void addItems(JComboBox combo, String[] itemList) { 
    8888 
     89          combo.setModel(new DefaultComboBoxModel(itemList)); 
     90 
     91          /* 
    8992          try { 
    90             combo.removeAllItems(); 
     93            //combo.removeAllItems(); 
    9194          } catch (IndexOutOfBoundsException ex) {} // does this if empty 
    9295 
    93        if (itemList.length > 0) { 
    94           for (int i = 0; i < itemList.length; i++) { 
    95               combo.addItem(itemList[i]); 
    96           } 
    97        } 
     96          if (itemList.length > 0) { 
     97             for (int i = 0; i < itemList.length; i++) { 
     98                 combo.addItem(itemList[i]); 
     99             } 
     100          } 
     101          */ 
    98102     } 
    99103 
     
    115119     /** Set the units combo box value. If the string is not in the box is will be added. */ 
    116120     public void setUnits(String units) { 
    117          unitsBox.setSelectedItem(units); 
     121         int idx = TimeUnits.getUnitIndex(units); 
     122         if (idx >= 0) unitsBox.setSelectedIndex(idx); 
    118123     } 
    119124 
Note: See TracChangeset for help on using the changeset viewer.