1 Reply Latest reply: Jan 11, 2013 9:03 PM by 984449 RSS

    how to check TextField is empty


      I am quite new to Java.
      I am trying to make a simple program which is just for practical purpose.

      Now, i have a JPanel and I put 2 different buttons (first button called:5, Second button called:4)there on the right side of the panel.
      On the left side, there are a few TextFields, which I named display1b,display2b,display3b...

      Now , when i click the button 5, First i like to check the first TextField (display1b) value and if it is empty then change the value to "5". If it is not then check the second TextField and if this one is empty, change the value to "5", if it is not check the next and then the next....

      This is my code.


      private void fiveActionPerformed(java.awt.event.ActionEvent evt) {
      //checking if the text area is empty:

      if((display1b == null)){

      } else
      if((display2b == null)){





      can anyone tell me where am i doing wrong?

      thanks in advance..