Changeset 52

Show
Ignore:
Timestamp:
05/21/09 14:00:46 (4 years ago)
Author:
frasten
Message:

CLOSED - # 30: Aggiungere una nuova patch nella posizione selezionata
 http://my-trac.assembla.com/oberheditor/ticket/30

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/oberheditor/gui/WinCanzone.java

    r50 r52  
    103103                btnAdd.addSelectionListener(new SelectionAdapter() { 
    104104                        public void widgetSelected(SelectionEvent e) { 
    105                                 listPatches.add(cmbBanco.getItem(cmbBanco.getSelectionIndex()) + "-" + 
    106                                                 String.format("%03d", Integer.parseInt(txtPatch.getText())) 
    107                                 );/* 
    108                                 ScrollBar sb = listPatches.getVerticalBar(); 
    109 //                                      sb.setMaximum(sb.getMaximum() + sb.getIncrement()); 
    110                                 listPatches.update(); 
    111                                 sb.setSelection(sb.getMaximum()); 
    112                                 System.out.println(sb.getMaximum());*/ 
     105                                String nomePatch = cmbBanco.getItem(cmbBanco.getSelectionIndex()) + "-" + 
     106                                String.format("%03d", Integer.parseInt(txtPatch.getText())); 
     107                                if (listPatches.getSelectionCount() <= 0) { 
     108                                        listPatches.add(nomePatch); 
     109                                        listPatches.select(listPatches.getItemCount() - 1); 
     110                                } 
     111                                else { 
     112                                        listPatches.add(nomePatch, listPatches.getSelectionIndex() + 1); 
     113                                        listPatches.setSelection(listPatches.getSelectionIndex() + 1); 
     114                                } 
     115                                 
    113116                                txtPatch.setSelection(txtPatch.getSelection() + 1); 
    114117                                txtPatch.setFocus();