writing something in jList

Posted by bigbluedragon on Stack Overflow See other posts from Stack Overflow or by bigbluedragon
Published on 2010-05-30T00:42:36Z Indexed on 2010/05/30 0:52 UTC
Read the original article Hit count: 215

Filed under:

hey i have another problem. I created jList in my main window and now i want to add something to it. I do it this way...

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) 

{          

           Dodaj_Przedmiot dodaj_przedmiot = new Dodaj_Przedmiot(null, true);
           dodaj_przedmiot.setVisible(true);
           SterowanieBazy instance = SterowanieBazy.getInstance();       
           Zmienne_pomocnicze zp = new Zmienne_pomocnicze();
           instance.dodajPrzedmiot(przedmiot);
           String przedm[] = instance.zwrocPrzedmioty();
           jList1.setListData(przedm);
}

what i want to write in that list is what i collect from my jDialogForm: dodaj_przedmiot

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) 

{

        String sciezka = jTextField1.getText();
        if (sciezka.length() > 0)
        {
          Zmienne_pomocnicze zp = new Zmienne_pomocnicze();
          zp.setPrzechowaj(sciezka);

        }
        this.setVisible(false);
    }                            

and i collect try to copy that date using this class

public class Zmienne_pomocnicze {

public String n;
public int a;

public void setPrzechowaj (String neew)

{

    n = neew;
}

public String getPrzechowaj ()

{

    return n;
}

}

i would be grateful for any ideas how to make it works^^

© Stack Overflow or respective owner

Related posts about java