i am pretty new to java i wrote this code but setText doesnt work i mean i cant reset the contol after type a value .what is wrong friends

   private void jTextField1KeyReleased(java.awt.event.KeyEvent evt) {                                        
       String gelen=jTextField1.getText();

    Random rnd=new  Random();
    int secilen=new Integer(rnd.nextInt(3));
    jOptionPane2.setMessage("Girdiğiniz sayı "+gelen
            +"\n Benim tututuğmdan büyük   "+secilen);
    jOptionPane2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resim/tux.png")));

    }else if(Integer.parseInt(gelen)<secilen){

        jOptionPane2.setMessage("Girdiğiniz sayı "+gelen
            +"\n Benim tututuğmdan küçük   "+secilen);

         jOptionPane2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resim/tux.png")));

    else if(Integer.parseInt(gelen)==secilen){
        jOptionPane2.setMessage("Tebirkler   ");

         jOptionPane2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resim/tux.png")));



what do you mean: the control?
is the value of jTextField1 'the control'?
are you sure you are passing through the right if or else block?

yes i mean jtextfield.everyting looks ok.i l put the jtextfield outside loops but nothing changed .i cant reset jtextfield the other things work properly

pretty hard to spot without the rest of the code ...
what I meant was: are you sure that the if (or else) block where you reset the text (or should be resetting it) is executed?

hi friend i sorry my english i got what you meant and no. the code not exacuted neither in the if block nor outside block.i tried debugging (watched videos on youtube to learn how to do )and i saw the code waits here and doesnt leave the loop

** jOptionPane2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resim/tux.png")));**

why would you do something like that in the first place?
so, if you don't set that icon, the application runs as should? then don't change the icon, or find a way that it doesn't make the code hang.

having working code is way better then have a nifty looking non-working frame.

why would you do something like that in the first place?

thats simple practising

if you don't set that icon, the application runs as should? then don't change the icon

the point is not that application runs as should .how can i make progress this way.. when you hit an abstacle nevermind leave it .is that what you mean

no,but if you are working on an actual project, with different deadlines, then it's best to let this one "slide" for now.
but you still haven't answered the question. does the application run perfect without that line?
if so, does the application hang when you keep that line, or just doesn't run the setText?
if so, have you tried doing the setText before setting the icon?