Meaningless Drivel is fun!*
The moose likes Beginning Java and the fly likes adding new button to gui calculator Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "adding new button to gui calculator" Watch "adding new button to gui calculator" New topic
Author

adding new button to gui calculator

mike saggese
Greenhorn

Joined: Nov 27, 2012
Posts: 8
Hi, this might be a oddball question but how do I add total payment to this gui calculator? I know the code works for sure, and somewhere in the code there's

//Labels to identify the fields
private JLabel amountLabel;
private JLabel rateLabel;
private JLabel numPeriodsLabel;
private JLabel paymentLabel;

//Strings for the labels
private static String amountString = "Loan Amount: ";
private static String rateString = "Interest Rate (%): ";
private static String numPeriodsString = "Years: ";
private static String paymentString = "Monthly Payment: ";

//Fields for data entry
private JFormattedTextField amountField;
private JFormattedTextField rateField;
private JFormattedTextField numPeriodsField;
private JFormattedTextField paymentField;

//Formats to format and parse numbers
private NumberFormat amountFormat;
private NumberFormat percentFormat;
private NumberFormat paymentFormat;

can I just simply add total payment to the JFormatted TextField and paymentString or is there something else I need to do?

fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11169
    
  16

mike saggese wrote:Hi, this might be a oddball question but how do I add total payment to this gui calculator? I know the code works for sure, and somewhere in the code there's

can I just simply add total payment to the JFormatted TextField and paymentString or is there something else I need to do?

What happened when you tried it?


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
mike saggese
Greenhorn

Joined: Nov 27, 2012
Posts: 8
fred rosenberger wrote:
mike saggese wrote:Hi, this might be a oddball question but how do I add total payment to this gui calculator? I know the code works for sure, and somewhere in the code there's

can I just simply add total payment to the JFormatted TextField and paymentString or is there something else I need to do?

What happened when you tried it?


I know that without the button all I have to do is hit enter and it automatically calculates the payment. but what if I add the button to the code, where should I add it so it won't mess up the entire thing.

Another question I have is how do I make this java file also a web page html file?
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11169
    
  16

again, I'll ask "What have you tried?"

Folks here don't hand out solutions to problems. We try to teach and guide. We expect you to ShowSomeEffort (that's a link to a page you should probably read). In fact, you may want to read much of this to get the most out of our site.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: adding new button to gui calculator
 
Similar Threads
Text area
Buttons don't work
IE6 applet problem html posted
GUI Mortgage Calculator
Java applet program (together with its html test file) to calculate loan payments.