Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

boolean problem  RSS feed

 
Alex Kravets
Ranch Hand
Posts: 476
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
At our company we have a Java Applet based database system. In one of the Applets I programmed that used Swing, I used boolean checking to see wheater a value in JTextField was entered. Everything worked fine: if value was entered boolean = true, if not boolean = false.
However, after one of our clients ran Applet on their machines, what would happen is that boolean would not register presence of a value in a JTextField. This in turn would make Applet act crazy since blocks of Applet were dependant on correct value of boolean. I tried to figure out what was going on, because on all our machines Applet would work just fine. I even tested Applet on same configuration as client JDK 1.3.1_06, Windows 98 SR2, IE 6.0.2800.1106...everything runs fine here -- crashes at the client. At the end, I just used counter instead of boolean and everything was working fine after that.
However, I am still puzzled by why would this sort of thing happen? Is there something about how Java uses boolean that Windows don't like?
thanks,
Alex
 
Greg Charles
Sheriff
Posts: 3015
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You've got to give us a fighting chance to be able to help you Alex. You say you are using a boolean to indicate whether text has been entered into a text field. OK, what logic do you use to set that boolean? Where do you perform that logic? Your claim that switching to using a counter fixed the problem is equally cryptic. What counter? What does it count?
 
basha khan
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i think u may be using
boolean abool=textfield.getText().equals(null)
and so on..
logic is good no probs.check where u 've declared the variable and initialises.I think that may the problom
.otherwise send the code.
basha
SCJP
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!