File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Blanking out a button if they do not have enough funds in their bank.

 
Brian O'Connor
Greenhorn
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey guys, im new to java and am wanting to disable a button say "20" if they do not have enough funds in their bank. I have had a shot at it but i keep getting "operator cannot be applied to java.lang.string,double. I'm pretty sure im missing something simple here.. =(





 
Paul Clapham
Sheriff
Pie
Posts: 20185
26
MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, the simple thing you missed was to tell us which of those 400 lines of code produced that error message. I wouldn't expect anybody to examine the whole lot carefully to figure that out, when you could just tell us.
 
Brian O'Connor
Greenhorn
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, found on line 88.

double currentBalance=
(new Double (atmData.getBalance())).doubleValue();
if (input <= currentBalance) {
au20Button.setEnabled(false);
 
Maneesh Godbole
Saloon Keeper
Posts: 10971
11
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hint:
Can you compare apples and oranges? String and double? Windoze and Mac?
 
Brian O'Connor
Greenhorn
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah, im only new to Java so i dont have alot of knowledge, but how do i go about rectifying this issue? do you convert the string or what?
 
Maneesh Godbole
Saloon Keeper
Posts: 10971
11
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Convert the String to double and then compare. Hint:Check out the Double constructor.
 
Brian O'Connor
Greenhorn
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So this compiles but it's not blanking out the buttons.

 
Maneesh Godbole
Saloon Keeper
Posts: 10971
11
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So what's the value of currentBalance?
 
Brian O'Connor
Greenhorn
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
$100 by default
 
Maneesh Godbole
Saloon Keeper
Posts: 10971
11
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would suggest using
to check what actual value you are getting.
 
Brian O'Connor
Greenhorn
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok just tried that and it is working, when i withdraw $20 the console produces $80.
 
Maneesh Godbole
Saloon Keeper
Posts: 10971
11
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And the 20 and 50 buttons are getting disabled?
 
Brian O'Connor
Greenhorn
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you mean if they are disabling if the balance is under the withdraw amount? then still no =(
 
Maneesh Godbole
Saloon Keeper
Posts: 10971
11
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think it would help if you post your SSCCE code, which we can download and run in our environment. Please do take out time to click on the SSCCE link to find out what it really means.
 
Brian O'Connor
Greenhorn
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok so you would like me to upload all of the classes and other information?
 
Maneesh Godbole
Saloon Keeper
Posts: 10971
11
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maneesh Godbole wrote:Please do take out time to click on the SSCCE link to find out what it really means.

Did you do this?
http://sscce.org/
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic