elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Arreglado, de nuevo, el registro del warzone (wargame) de EHN


  Mostrar Mensajes
Páginas: [1]
1  Programación / Java / Re: problemas de entendimiento del bubble sort en: 7 Octubre 2012, 20:34 pm
YA LO CAMBIE A ESTA FORMA PERO EL PROBLEMA ES JALARLO AL JLIST
public class modelo {
private double [] numeros = new double
  • ;
private double aux;
private int i, j;
    private String exponer;
    /**
     *
     * @param
     */
public double[] getnumeros(){
    return numeros;
}
public void setnumeros(double[] numeros){
    this.numeros=numeros;
}
public double getaux (){
    return aux;
}
public void setaux(double aux){
    this.aux=aux;
}
public int geti (){
    return i;
}
public void seti(int i){
    this.i=i;
}
public int getj (){
    return j;
}
public void setj(int j){
    this.j=j;
}
public String getexponer (){
    return exponer;
}
public void setexponer(String exponer){
    this.exponer=exponer;
}
public void ordenar()
{
 for (i=0;i<numeros.length;i++) 
 {
   numeros=Double.parseDouble(null); 
 }
 for (i=1;i<numeros.length;i++)
     for (j=0;j<numeros.length-i;j++)
         if (numeros[j]>numeros[j+1])
     {
         aux=numeros[j];
         numeros[j]=numeros[j+1];
         numeros[j+1]=aux;
     }
}
 public void exponer ()
 {
   for (i=0;i<numeros.length;i++)
   {
       exponer=("["+i+"]:"+numeros);
 }
 
}

    public void setnumeros(int parseInt) {
        throw new UnsupportedOperationException("Not yet implemented");
    }

}
   
Y HE AQUI DONDE VIENE EL ASUNTO EN EL BOTON DE ORDENAR ESTOY TRABAJANDO EN NETBEANS MVC
 private void jb_ordenarActionPerformed(java.awt.event.ActionEvent evt)
    {
       modelo.setnumeros(Integer.parseInt(vista.jtf_numero.getText()));
       modelo.setnumeros(Integer.parseInt(vista.jl_lista.toString()));
       vista.jl_lista.setToolTipText(""+modelo.getexponer());
       modelo.exponer();
         modelo.ordenar();
    }
2  Programación / Java / Re: problemas de entendimiento del bubble sort en: 7 Octubre 2012, 19:06 pm
gracias probablemente sea es el problema lo voy a checar thanks
3  Programación / Java / problemas de entendimiento del bubble sort en: 7 Octubre 2012, 17:53 pm
 ::) Que tal maestros de la programacion soy relativamente nuevo en esto de la programacion y tengo una duda como puedo mostrar un arreglo que haces en modelo y traerlo a un controller para mostrar el bubble sort en un jlist con mvc de netbeans
al parecer ya me agrega los elemntos al jlist pero no hace nada me marca error en esta linea
 private void jb_ordenarActionPerformed(java.awt.event.ActionEvent evt)
    {
           
        modelo.ordenar(arreglo);
        vista.jl_lista.setModel(lista);
    }
codigo de los metodos agregar y ordenar
public void agregar()
   {
       int r=this.numero;
       for (int j=0;j<numero;j++)
       {
           int x=numero;
           arreglo[j]=x;
       }
   }
       public void ordenar (int []arreglo)
       {
          int temp;
          boolean modificaciones=false;
          while (true)
          {
              modificaciones=false;
              for (int j=1;j<arreglo.length-1;j++)
              {
                  if (arreglo[j]<arreglo[j-1])
                  {
                      temp=arreglo[j];
                      arreglo[j]=arreglo[j-1];
                      arreglo[j-1]=temp;
                      modificaciones=true;
                  }
              }
              if (modificaciones==false)
                  break;
          }
       }

   
   }
se que la respuesta para muchos debe de ser bastante sencilla pero estoy atorado agradezco cualquier ayuda.
Páginas: [1]
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines