Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

calculator applet

 
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am doing this calculator applet and it is working except for some reason it is only taking single digits. I don't know why. I thought I was setting it up so that the second digit would concatenate to the first digit. Any help on this would be great.
My code is below. I am sorry if it is not formatted correctly; I couldn't figure out how I was supposed to format it for this board.


[This message has been edited by Marilyn deQueiroz (edited December 17, 2001).]
 
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Jade!
Notice the statement
first_num_flag = true;
on the last line of the mousePressed(MouseEvent m)-method. I think that line is the problem. I haven't studied your code too closely, but try removing it and see what happens.
Hope this helps!
//Kaspar
 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I haven't looked to closely, but instead of concatenating strings, why don't you use a StringBuffer-object which you can change in the way you want.You can find it in java.lang package.
 
Aaaaaand ... we're on the march. Stylin. Get with it tiny ad.
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic