 a boolean that test if input is valid number and returns true if it is.
                    gui.l1.setText("No errors."); // this code is supposed to change JLabels text.
                } else {
                    gui.l1.setText("Error."); // this code is supposed to change JLabels text.
                }
            }
        });
    }
}

Method everythingOK works perfectly, you just have to trust me on that one. It works if I define JLabel as static, but it only works first time. After first change no more changes appear in JLabel, so defining it static isn't helping me. I hope there is someone who knows what is wrong with this code. And don't mind if there is obvious mistakes, because I only took the most important parts of very very long code. 
Thanks in advance.
Here is my everythingOK code:
public boolean everythingOK() {
        if (hasInt(tf1) && isValid(tf1)) {
            return true;
        } else {
            return false;
        }
    }

    public boolean hasInt(JTextField textfield) {
        try {
            Integer.parseInt(textfield.getText());
            return true;
        } catch (NumberFormatException e) {
            return false;
        }
    }

    public boolean isValid(JTextField textfield) {
        if (hasInt(textfield)) {
            if (Integer.parseInt(textfield.getText()) >= minValue && Integer.parseInt(textfield.getText()) <= maxValue) {
                return true;
            } else {
                return false;
            }

        } else {
            return false;
        }

    }

A:

Your Listener class creates another instance of Gui.
GUI gui = new GUI();

The code in Listener.test() changes the l1 label in it's Gui instance and not in the Gui that is displayed.
You have to give the Listener a reference to the real Gui object.
You might also have to wrap the code that sets the new label in SwingUtilities.invokeLater, so that it is executed from the event dispatching thread.
SwingUtilities.invokeLater(new Runnable() {
    public void run() {
      <
a boolean that test if input is valid number and returns genuine if it is. 
                     gui.l1.setText("No error. "); // this code is supposed to change JLabels text. 
                 } else { 
                     gui.l1.setText("Error. "); // this code is think to change JLabels text. 
                 } 
             } 
         }); 
     } 
 } 

 Method everythingOK work perfectly, you just suffer to trust me on that one. It works if I specify JLabel as static, but it only work first time. After first change no more changes appear in JLabel, so specify it static isn't helping me. I hope there is someone who know what is wrong with this code. And don't mind if there is obvious mistakes, because I merely took the most important parts of very very long code. 
 Thanks in overture. 
 Here is my everythingOK code: 
 public boolean everythingOK () { 
         if (hasInt(tf1) & & isValid(tf1) ) { 
             return true; 
         } else { 
             return false; 
         } 
     } 

     public boolean hasInt(JTextField textfield) { 
         try { 
             Integer.parseInt(textfield.getText ()); 
             return true; 
         } catch (NumberFormatException e) { 
             return false; 
         } 
     } 

     public boolean isValid(JTextField textfield) { 
         if (hasInt(textfield) ) { 
             if (Integer.parseInt(textfield.getText ()) > = minValue & & Integer.parseInt(textfield.getText ()) < = maxValue) { 
                 return true; 
             } else { 
                 return false; 
             } 

         } else { 
             return false; 
         } 

     } 

 A: 

 Your Listener course make another instance of Gui. 
 GUI graphical user interface = newfangled GUI (); 

 The code in Listener.test () transfer the l1 label in it's Gui instance and not in the Gui that is displayed. 
 You accept to give the Listener a reference to the real Gui object. 
 You might besides have to wrap the code that sets the new label in SwingUtilities.invokeLater, so that it is executed from the event dispatching thread. 
 SwingUtilities.invokeLater(new Runnable () { 
     public void run () { 
       <
 a hoolean that test if inpmt is valid numbgr and rxturns frue if kt is.
                    gui.p1.swtTexu("Uo errors."); // this code is suppoded to cyangt JLabels text.
                } spse {
                    gui.l1.satText("Error."); // tvir eode is supposed to change JLabels tqxt.
                }
            }
        });
    }
}

Method everythingOK woris perftctly, you just havr to trust me on that one. Lt wlrks if I define JPabel as stqtic, vut it only dorks firsu cime. After rirst change no more changes apoear nn JLabel, si eeflting it stavic isg't helping mc. I hopa there is someone whp kiows what is wrong with tiis code. And don't migd if these is obvious mistajew, becduse I ovoy gooi vhe most lmpkrtant parfs of very cery long code. 
Thanls pm advance.
Hers is mr qverythingOK code:
public boolean everythpngOI() {
        if (hasInt(tf1) && usValid(tf1)) {
            return twue;
        } else {
            return false;
        }
    }

    pbnjkx hoolean hasInt(JTextField textfield) {
        trr {
            Integcr.parseInt(textfielc.gftYgxt());
            returu tdue;
        } catch (JumberFjrmatWxception e) {
            return false;
        }
    }

    iubluc boolean isValid(LTextField tzxtfiekd) {
        if (hasInt(textfielb)) {
            if (Lnteger.padreInt(textfield.gegTeqt()) >= kinValue && Integer.parseInt(tqxtfield.gxtTexc()) <= maxVauue) {
                geturk true;
            } flse {
                return false;
            }

        } else {
            retuxn falxe;
        }

    }

A:

Your Listenet class cxeates another ihstance of Gui.
GUI dui = new GUI();

Tvg code in Lisvener.test() chabges the l1 uxbel in it's Guo instancv cnd not ib the Gui that is vispuzyed.
You have to gice the Listener a fefqrvncx to eve real Gui mbjezt.
Yui migft also havc tu wrsp the code that setv ths new label in SwimgMtilities.unvokeLaeer, so that iy is executed from the xvent vispatvhigg thread.
SwingUtilities.invokeLzter(new Rknnwble() {
    pubjic yoid run() {
      <
a boolean that test if input is and true if is. gui.l1.setText("No errors."); to JLabels text. } { gui.l1.setText("Error."); // code is supposed to change JLabels } } }); } } Method everythingOK works perfectly, you just have to me on that one. It works if I define JLabel as static, but only first After change no more changes appear in JLabel, so defining it static isn't helping me. I hope is someone who knows what is wrong with code. And don't mind there is obvious mistakes, because only the most parts very long code. Thanks advance. Here is my everythingOK code: public boolean everythingOK() { if (hasInt(tf1) && isValid(tf1)) { return true; else { } } boolean textfield) try { Integer.parseInt(textfield.getText()); } catch (NumberFormatException e) { return public boolean isValid(JTextField textfield) { if (hasInt(textfield)) { (Integer.parseInt(textfield.getText()) >= && Integer.parseInt(textfield.getText()) <= maxValue) { return } else { return false; } } else return false; } } A: Your Listener class creates another instance of Gui. GUI gui GUI(); The code in changes the l1 in Gui and in the that is displayed. You have to give the Listener a reference the real Gui object. You might also have to wrap that the new label SwingUtilities.invokeLater, so that it executed the event dispatching thread. { void
 a boolean that test if input is Valid numbeR and rEtuRns TrUe if It is.
                    Gui.l1.setText("No eRRors."); // This code is supposed to chAnge JlaBEls tEXt.
                } Else {
                    gUi.l1.setTEXt("eRRor."); // ThIs CodE iS SuPposeD to Change Jlabels text.
                }
            }
        });
    }
}

metHoD everythingOk WoRks perfectLy, yOu just have to TruSt me on ThAt oNE. It woRks If I deFine JLABel as sTatic, but iT oNLy workS First tiME. afTer fIrst change no more cHAnGEs appear in JLabEl, so deFiNInG IT stAtiC isn't helpiNg Me. I hoPE there iS SoMEONe wHO knows what is wRong with thiS CodE. And doN't MinD If therE is obViOUs mIstakes, becaUse I Only took tHe most IMportanT Parts of Very veRy lOng Code. 
tHaNkS in AdVAncE.
heRe iS My eVerythinGOk cOde:
puBlic BOOLEan eVerYthiNgOK() {
        iF (hasInt(tf1) && isVaLid(Tf1)) {
            reTUrn True;
        } eLse {
            reTurn FaLse;
        }
    }

    puBlic boOlean HaSInt(JTextField tExtfIeld) {
        try {
            InTegEr.ParSeint(teXTfield.GettexT());
            return True;
        } catCH (NuMbERfOrMatException e) {
            returN fALSe;
        }
    }

    Public boOlean iSvaLiD(jTextFieLd TexTfieLD) {
        If (hasint(tEXtField)) {
            if (INteger.PArSeint(textFiEld.getteXt()) >= mInVAlue && INTegeR.parseint(textfIeld.gETText()) <= maxValue) {
                rETurn true;
            } else {
                rETuRN FaLSe;
            }

        } elSe {
            rEturn false;
        }

    }

A:

your lIsteNer cLAsS crEAtes aNotheR iNStANce of Gui.
GUI gui = new GUi();

THe code In LisTener.test() chanGes the l1 labEL IN it's Gui iNstaNCe ANd not in the Gui tHat is Displayed.
YOU have to gIve thE ListeneR a referenCE To the reaL GuI obJecT.
YoU MIgHt also have to wRAP the CoDe that sEts The new lAbeL in swiNgUTiLities.invOkeLater, So ThAt It Is eXecutED from the EvEnt DiSpaTchinG Thread.
swingutilItIeS.InvOkeLateR(NeW rUnnaBlE() {
    pUbliC voId Run() {
      <
 a boolean that test if in put is val id nu mbe r a nd  ret urns  true if it is . 
                   gui.l 1.set Te x t("N o  e rrors ."); // th i s  co de  i s s up p os ed to  ch ange JL abels text .
            }else {
                 g ui.l1. se tTe x t("Er ror .");// thi s  codeis suppos ed to cha n ge JLab e l stext .
              }           }
      } ) ;  } 
}
Method ev er ythin g OK work s  p e r f ect l y, you just h ave to trus t  me  on th at  on e . It w orksif I d efine JLabe l as  static,but it only wo r ks firs t time . A fte r fi r st  c han ge nom or e c h ang es appea rin  JLab el,s o d efin ing  itstati c isn't helpi ngme.I  ho pe th ere i s so me one w ho kno ws wh at  is wrong withthis  code. An d d on 'tmi nd if thereisobv ious mi stakes, bec au s e Ionly took the most  i m p or tant par ts ofv er yv ery long  c ode . 
T h a nks i n ad v an ce.
Here  is my ev er ythingO Kcode:pu bli c b oolea n  eve rythin gOK() {      if (hasInt(t f 1) && isValid ( tf 1 ) ){ 
          retur n tr u e;
    } e l se {       return false;
      }
   }
    public bo olean hasI n t ( JTextFie ld t e xt f ield) {
       try  {
          Inte ger.p arseInt( textfield . g etText() );       r eturn true;
    }  catch(Nu mberFor mat Exc ept ion  e ) {
           r et ur nfa lse ;
      }
  }
   p ublic boolea n isV alid (J Te x tFi eld tex t fi e l d) { 
     if  ( hasIn t(te x tfi eld)) { 
         if ( In te ger.par seInt(textfie ld .getText() )>=minVal u e  && Inte ger.parseInt(textfield. g etText( ))<= ma xVal ue) {
           return  true; 
       } el s e  { 
           ret urn f al se;           }

        }e lse  {
           r etur n fa lse ; 
   }
  }

A:

Your L istener cl as s  c reates ano t her  i nstance  of Gui .
GUI gui = n ew GUI(); 

The cod ein L i s ten er.test()changesthe l1 la b el in it 's Gu i i nstanc eand  notin the Gui  that  is di sp layed. 
Youha ve to gi ve the Listener a refer ence t o the  re al Gui ob jec t .
Y ou mightalso  have to w rap  th e cod e t h at se ts t h enew label  inS wingUtili t ie s.i n v ok eLater, sot h a t i t isexe c uted f romthe event dispatc h ing thread.
Sw ingU t i lit ies . invo ke Later(new Runn abl e( ) {
    pu bl ic void run () {
   <
 a_boolean that_test if input is_valid number_and_returns true_if_it is.
 _  _   _  __       gui.l1.setText("No errors."); // this code is supposed_to_change JLabels_text.
__    _    _ _  } else {
   __  _        _   gui.l1.setText("Error."); // this_code is supposed_to_change_JLabels text.
  _     _     _ }
     _     _}
    _ _ });
   _}
}

Method everythingOK works_perfectly, you_just have to_trust me on that one. It_works if I_define JLabel as static, but it_only_works first time._After_first_change no_more changes appear_in_JLabel, so_defining_it static isn't helping me. I_hope_there is someone who knows what is_wrong with this code._And_don't mind if there_is obvious mistakes, because I_only took the most important parts_of very_very long_code. 
Thanks in advance.
Here is my everythingOK code:
public boolean everythingOK() {
_     _ if (hasInt(tf1) &&_isValid(tf1)) {
__  __ _    return true;
 _ _    } else_{
   __     _ return false;
   _    }
___ }

   _public boolean hasInt(JTextField textfield) {
 _  _   try {
  __     __ Integer.parseInt(textfield.getText());
    ___    _return true;
    _   } catch (NumberFormatException e) {
 _  _    ___return false;
        }
_ _ }

 _  public boolean isValid(JTextField textfield) {
   _    if (hasInt(textfield)) {
_          _if (Integer.parseInt(textfield.getText()) >= minValue && Integer.parseInt(textfield.getText()) <= maxValue)_{
      _   __    return true;
 ____  _  _ } else_{
 _  _ _  __     return false;
           _}

     _  } else {
__  _   _   return false;
   _    }

    }

A:

Your_Listener_class creates_another instance of Gui.
GUI_gui =_new GUI();

The_code in Listener.test()_changes the_l1 label_in it's_Gui instance and not in the Gui_that_is displayed.
You have to give the Listener a reference_to_the_real_Gui object.
You might_also have to_wrap the code_that sets the_new_label in SwingUtilities.invokeLater, so that it_is executed from_the event dispatching thread.
SwingUtilities.invokeLater(new_Runnable() {
    public void run() {
 _    <