Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. /*
  2. * To change this template, choose Tools | Templates
  3. * and open the template in the editor.
  4. */
  5.  
  6. package intentoswing;
  7.  
  8. /**
  9. *
  10. * @author basesdatos
  11. */
  12. public class ModeloListaStrings extends javax.swing.AbstractListModel {
  13. java.util.List<String> elementos;
  14.  
  15. public ModeloListaStrings(){
  16. this.elementos=new java.util.ArrayList<String>();
  17. }
  18.  
  19. public int getSize(){
  20. return this.elementos.size();
  21. }
  22.  
  23. public String getElementAt(int i){
  24. return elementos.get(i);
  25. }
  26.  
  27. public void nuevoElemento(String e){
  28. this.elementos.add(e);
  29. fireIntervalAdded(this, this.elementos.size()-1, this.elementos.size()-1);
  30. }
  31.  
  32. public void borrarElemento(int i){
  33. String e;
  34. e=this.elementos.get(i);
  35. this.elementos.remove(i);
  36. fireIntervalRemoved(this,i,i);
  37. }
  38.  
  39. public void setElementos(java.util.List<String> elementos){
  40. this.elementos=elementos;
  41. fireContentsChanged(this, 0, elementos.size()-1);
  42. }
  43.  
  44. public java.util.List<String> getElementos(){
  45. return this.elementos;
  46. }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement