non-static method setPrzechowaj(java.lang.String) cannot be referenced froma a static context

Posted by bigbluedragon on Stack Overflow See other posts from Stack Overflow or by bigbluedragon
Published on 2010-05-29T23:51:43Z Indexed on 2010/05/30 0:02 UTC
Read the original article Hit count: 204

Filed under:

hey i have problem with JDialogForm. I have created it using netbeans 6.8. That JDialogForm have textfield and button below it. and here is some code...

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                         
       String sciezka = jTextField1.getText();
       if (sciezka.length() > 0)
       {
          Zmienne_pomocnicze.setPrzechowaj(sciezka);
       }
   }  

Now i want to copy that string "sciezka" to my main window but if I do it like this

public class Zmienne_pomocnicze {

public String n;
public void setPrzechowaj (String neew)
{
   n = neew;
}
public String getPrzechowaj ()
{
   return n;
}

}

i get error in jButton1: non-static method setPrzechowaj(java.lang.String) cannot be referenced froma a static context any ideas?

© Stack Overflow or respective owner

Related posts about java