private void addItem(){
  String item=editor.showDialog("Add entry:","",info);
  item=format(item);
  if (item != null && !item.isEmpty() && !data.contains(item)) {
    int selectedIndex=list.getSelectedIndex();
    if (selectedIndex != -1) {
      data.add(selectedIndex + 1,item);
      list.setSelectedValue(item,true);
    }
 else {
      data.addElement(item);
    }
    input.setText("");
  }
}

private void addItem ( ) { String item = editor . showDialog ( "Add entry:" , "" , info ) ; item = format ( item ) ; if ( item != null && ! item . isEmpty ( ) && ! data . contains ( item ) ) { int selectedIndex = list . getSelectedIndex ( ) ; if ( selectedIndex != - 1 ) { data . add ( selectedIndex + 1 , item ) ; list . setSelectedValue ( item , true ) ; } else { data . addElement ( item ) ; } input . setText ( "" ) ; } }
add the item currently in the input box , but not if it ' s empty or already in the list .
