Trying to make a pop up message for a loan calculator

Yes this is very basic, but I am very basic. I am using the init() method, and paint() method "classes" as applet to make a loan calculator. I have the calculating all done, and correct, but if someone puts in a nonreal number, or an amount they want to take in less than 0 I want the pop up message tell them they are crazy. How would I create a message popup? The code below is the full code for my loan calculator.
* Programmer: Carl Finch
* Program: The Bank of America Loan Calculator(not affiliated with Bank of * America just a goof)
* Date: 01/12/05
* Purpose: Learn the paint() function, action performed function, and
* all their "special methods"
import java.awt.*;
import java.awt.event.*;
import java.text.*;
import java.applet.*;
public class Loan extends Applet implements ActionListener
// Declare the vars
TextField txtAmo;
TextField txtRat;
TextField txtMon;
TextField txtPay;
Button btnCal;
public void init()
//set the layout of the textfields, layouts, and the big o butotn.
setLayout(null);
txtAmo = new TextField (25);
txtRat = new TextField(5);
txtMon = new TextField(6);
txtPay = new TextField(8);
btnCal = new Button("Calculate");
txtAmo.setBounds(145,25,80,30);
txtRat.setBounds(145,65,80,30);
txtMon.setBounds(145,105,80,30);
txtPay.setBounds(145,145,80,30);
btnCal.setBounds(145,200,80,30);
//add all to applet
add(txtAmo);
add(txtRat);
add(txtMon);
add(txtPay);
add(btnCal);
btnCal.addActionListener(this);
//Create graphics for the applet
public void paint(Graphics g)
// simple text displayed on applet
g.setColor(Color.white);
g.fillRect(0, 0, 500, 500);
g.setColor(Color.blue);
g.drawString("Bank of America Loan Calculator", 145, 20);
g.setColor(Color.blue);
g.drawString("Loan Amount",30,35);
g.drawString("APR (%)", 30,75);
g.drawString("Months to Repay",30,115);
g.drawString("Monthly Payment:",30,155);
//Adding image method
Image money;
money = getImage(getDocumentBase(), "money.jpg");
g.drawImage(money, 300,50, this);
//Action Performed
public void actionPerformed(ActionEvent ae)
//Declaring the vars needed.
//try
DecimalFormat money = new DecimalFormat("$#.00");
double a = Double.valueOf(txtAmo.getText()).doubleValue();
double r = Double.valueOf(txtRat.getText()).doubleValue();
int m = Integer.parseInt(txtMon.getText().trim());
r=r/1200;
//The math of the monthly payment
double p=a*r/(1-Math.pow(1/(1+r),m));
txtPay.setText(""+money.format(p));
/*catch(ArithmeticException error)
//Find option for java.awt
//Adding some error messages for the technology inleterates.
Sorry I had to display the code, but I don't know how to do attachements

javax.swing.JOptionPane.showMessageDialog(null, "Message here");

Similar Messages

  • HT3819 For home sharing do you have to use one apple ID? Im trying to make my own new account for all my devices (iphone, ipad, mac) , but i still want the music from my dads account.

    For home sharing do you have to use one apple ID? Im trying to make my own new account for all my devices (iphone, ipad, mac) , but i still want the music from my dads account.

    For home sharing do you have to use one apple ID? Im trying to make my own new account for all my devices (iphone, ipad, mac) , but i still want the music from my dads account.

  • Im trying to make a simple 360 rotation for a 3d logo in CC 2014 but when i tried to create the 1st key frame the image when out axis

    im trying to make a simple 360 rotation for a 3d logo in CC 2014 but when i tried to create the 1st key frame the image when out axis

    I find that if you have multiple 3d object  they must be merged into a single 3d layer their positions reset to align to the same axises then sized and positioned along them. The layer should then be able to be animated well around an axis like the y axis. Here a Sphere, Cylinder and ring. http://www.mouseprints.net/old/dpr/McAssey-CC.mp4

  • HT4061 I tried to upgrade to IOS 6 and all I am getting when I am trying to re-start is a message for connect ti Itunes?  Help

    I tried to upgrade to IOS 6 and all I am getting when I am trying to re-start is a message for connect ti Itunes?  Help

    IPhone, iPod Touch, and iPad iOS Compatibility
         Device                                       iOS Verson
    iPhone 1                                       iOS 3.1.3
    iPhone 3G                                    iOS 4.2.1
    iPhone 3GS                                 iOS 6.1
    iPhone 4                                       iOS 6.1
    iPhone 4S                                    iOS 6.1
    iPhone 5                                       iOS 6.1
    iPod Touch 1                               iOS 3.1.3
    iPod Touch 2                               iOS 4.2.1
    iPod Touch 3                               iOS 5.1.1
    iPod Touch 4                               iOS 6.1
    iPod Touch 5                               iOS 6.1
    iPad 1                                           iOS 5.1.1
    iPad 2                                           iOS 6.1
    iPad 3                                           iOS 6.1
    iPad 4                                           iOS 6.1
    iPad Mini                                      iOS 6.1
    Upgrading iOS
       1. How to update your iPhone, iPad, or iPod Touch
       2. iPhone Support
       3. iPod Touch Support
       4. iPad Support
         a. Updating Your iOS to Version 6.0.x from iOS 5
              Tap Settings > General > Software Update
         If an update is available there will be an active Update button. If you are current,
         then you will see a gray screen with a message saying your are up to date.
         b. If you are still using iOS 4 — Updating your device to iOS 5 or later.
         c. Resolving update problems
            1. iOS - Unable to update or restore
            2. iOS- Resolving update and restore alert messages

  • Trying to make a back ground transparent for a web site

    Trying to make a back ground transparent for a web site on a logo image

    There is no picture? Did you try sending it by email? You'll have to sign into the forum and use the camera icon to upload. Thank you.
    Benjamin

  • Pop up message for advance not coming at the time of invoicing.

    Dear All,
    The moment IV is being made pop up message for advance is not coming for those vendors who have been posted with advance before Apr.2010. Apr.2010 onward it is coming correctly for same vendors. FBKP checked and found ok about message setting.
    Please help me out of this issue.....
    Thanks and regards,
    DNJ.

    HI,
    Have you done the miro for capturing all the custom duties .iF done, the system will ask for the commercial invoice no during MIGo, then enter the corresponding invoice no and year, then the system will take you to the excise tab.
    Regards,
    velu

  • What change to the firewall Java is trying to make when it is launched for the first time?

    We are upgrading our jpi from 7u60 to 7u67.  We are running EBS 12.1.  We are having issues trying to deploy this to the organization with zero prompts and messages.  We are getting a firewall prompt from the plugin the first time we launch EBS.  What change to the firewall is java trying to make when we launch the plugin from EBS the first time?  I have attached screen shots of the messages we are seeing.  The first screen shot is on Windows 7x86 and the second is on Windows 7x64.  The x86 is prompting for jp2launcher.exe
    while the x64 is prompting to allow java.exe.  This is the same software package for both instances and we are using the IE 32-bit browser.

    You haven't downgraded the iOS or lost any features, what you've done is restored your phone from an old iOS backup.

  • Pop up message for 0019 infotype

    Hi gurus,
    can you help me out  my requirement is when ever i mainatain infotypes 0016 and 0019 system should pop a message showing the reminder date for that event can you tell me how can i do it .If i run a standard report date monitoring  i can see the data but i need automatically generated POP up message.
    Regards
    Smitha

    Hi,
    You can use Dynamic actions to get this done, please check table T588Z to do this configuration. Hope this will help you, Thanks.
    Regards,
    Sridhar.

  • Pop up message for pending sales order.

    My requirement is whenever a zgor sales order is being created for a particular material,if a pending sales order exists for the same material,the message should pop up : "number of sales orders pending for the given material",
    Pls help me how to write coding for this to deliver a pop up message.

    Hi,
             You need to find the correct exit for your req.  se38 -> sapmv45A-> INCLUDE MV45AFZZ and check the triggering point before saving the sales order . Write your necessary POPUP code..
    Regards,
    Kumar.

  • How to create a verification pop-up message for queries executed on Web

    I have implemented the function RRMS_MESSAGE_HANDLING in my customer exit variable code for step 2  in the customer include ZXRSRU01.  I am able to get warning and error messages to appear in Bex Excel queries, but not queries executed on the Web.  I have also tried implementing these queries in a Web Template which allows system messages and warning messages, but still these messages are suppressed.
    Is anyone aware of how to create warning messages that appear both in Bex Excel and Bex Web queries?
    Thanks for you help,
    Curt Timmerman

    On the Comments screen, just select the notes tool to add the note. When you are done, click to close the note.

  • Pop up message for confirmation in standard bsp on approve button

    Dear friends
               I am supposed to put one pop up confirmation message in 'hap_document' bsp application on approve button, this is MVC frame based application and used to show appraisal details. I have check with the event handlers, but is structured dynamically.  I have put a break point at various places. but from the portal when i m running the application it doesnt go into debugger..
    Please give me some ideas how to debug this application and how i will know the place where i need to do the coding for the pop-up confirmation message.. any help of yours will be greatly appreciated
    thanking you
    Regards
    Naeem

    Dear Naim Khan S Babi,
    Different controllers, views and BSP pages are availabe withing the application.
    You just keep the debug on the on the main methods like, DO_INIT, DO_REQUEST and DO_HANDLE_EVENT. So that you easily find where your application navigates.
    Hope this will be helpful.
    Regards,
    Gokul.N

  • Pop Up message for Contract expiration dates

    Hello, Experts,
      I am looking for a way to customize (If it's possible) a message as a pop-up.
    The message I want to become  a pop up is the message about the expiration
    date of a contract, which is displayed when creating a SC from an expired contract.
    Thank you for the help !
    Regards,
      Rami Kleiman
      HP

    Hi
    Contracts can be monitored by scheduling jobs so that Buyers get notification on fund / valid period by .bbp_contract_check
    contracts validity / fund can be indeed refered while shopping cart turn to purchase order.
    Hope  you could have refeered Ricardo article on this
    http://wiki.sdn.sap.com/wiki/display/SRM/Contractvalidationdoesnotoccurwhencreatingashopping+cart
    Muthuraman

  • Pop up message for Data loss

    Dear All,
    In CRMD_ORDER transaction we have added new custom tabs using CRMV_SSC transaction but not using EEWB. Now when I go to change mode and do some changes there and click BACK it does not give me pop up ( Do you want to save? Data loss...) before leaving the transaction. When I did some R&D on that I feel that the data from these custom fields are not updated in the buffer to set the Update flag which triggers the Data loss pop up before going out of the transaction.
    Please let me know how I can achieve this.
    Thanks a lot!!!

    This is for Change request in CRMD_ORDER.
    Thanks!!

  • [solved] Trying to make a bash function work for (chroot)

    So this is what I have so far.
    function arch-chroot () {
    sudo & mount /dev/sda1 /mnt
    cd /mnt
    mount -t proc proc proc/
    mount --rbind /sys sys/
    mount --rbind /dev dev/
    mount --rbind /run run/
    chroot /mnt /bin/bash
    I get stuck at cd /mnt. This is how I do it in terminal. I can't quite figure out to move past 'cd'.
    # just use the arch-install-scripts. Simple and easy. ------------
    Last edited by jedijimi (2015-01-25 18:11:19)

    It could be something like this:
    if [[ $EUID != 0 ]]; then
    echo "This script should be ran as root" && exit 1
    fi
    mount -t proc /proc $1/proc
    mount --rbind /sys $1/sys
    mount --rbin /dev $1/dev
    mount --rbind /run $1/run
    chroot $1
    This way it uses the default shell and asks for a new root as a parameter. But instead of reinventing the wheel just install arch-install-scripts as it only weights ~0.05MiB. Also when trilby had asked what do you want to do, he meant why are you using "sudo & ..." as sudo can't be run in background.
    Next time you can't find which package provides certain executable file, just use pkgfile.

  • ABAP HR: User exit or BADI for company loan calculation

    hi All,
    I need to calculate the company loan repayments in a different way (which is out of the standard), Please let me know which customer exit or BAPI can make this possible.
    Scenario:
    Principal Amt = Rs. 10,000
    Interest rate = 8%
    Yearly Interest = 10,000 * 8% = 800
    Monthly Interest = (10,000 * 8%)/ 12 (months) = Rs. 66.67
    Now, if an Employee is asking for a 6 month period to pay-off the loan then the calculation will be :-
    Principal Instalment = Rs. 10,000 / 6 (months) = Rs. 1667
    Interest Instalment = Rs. 66.67 * 6 = Rs. 400
    Total Instalment to be paid each month = Rs. 1667 + Rs. 400 = Rs. 2067.
    Thanks in Advance
    Amol

    Thanks for your answers.
    I need to make validations for send error messages and i can not use FI Validations and Sustitutions because i send several differents messages  and wuold need N steps (one step for each message).
    The enhancement points called in CHANGE_TO_MODIFY are executed when ok-code is 'CHAE' that is when the user calls FB03 and then change to modify mode for make changes like if he goes to FB02 , but these enhancements are no executed any more when the data changes are made and user press save.
    I already found some enhancement executed just before data saving (it's in FORM belegsummen_pruefen) so i make the validation and send the error message , but when error message appears the screen get protected so the user can not change any screen field for make the data corrections.
    Best Regards
    Frank

Maybe you are looking for