• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Java calculator problems. Old homework just never completed correctly

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I wrote this code directly from the book code block after code block. For my own learning experience following and typing the code myself helps me learn the syntax of code better than any copy and paste. Anyways I found myself debugging the code because of typos on my part, which is another learning experience. I cleared all bugs and it complies fine, but when I run the calculator it does not show the buttons at all. I used import java.swing.JOptionPane; at first and found that import javax.swing.JOptionPane; is the correct import format, but is this still causing the buttons not to show. I am using TextPad, but also using NetBeans because I want to move away from TextPad, they both are running the same results.

 
Rancher
Posts: 1093
29
Netbeans IDE Oracle MySQL Database Tomcat Server C++ Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Michael,

You need to add the line to your constructor so your keypad is part of your Frame.

Les
 
Rancher
Posts: 5008
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also the code needs to use the equals() method to compare Strings. not the == operator.
 
Michael W Adams
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you Les, that definitely helped. I went back into the book and seen that I had another typo after placing you response in the Frame. Found a few more mistakes that I had to correct, good learning experience. Thanks Norm, I am going to look into your response also, as of right now it is working correctly.
 
Uh oh, we're definitely being carded. Here, show him this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic