fieldChange get variables from the main class

I'm doing a simple calculator that users enter numbers, press on calculate, and the answer is displayed in the status bar.  The problem I have is that when I try to get the EditFields values in the fieldListener, I get an error that says that the variable was not found.  Here is an example of the code that I have:

public class MyScreen extends MainScreen {
    public MyScreen() {
        super();
        LabelField title = new LabelField("Automotive Loan Calculator", LabelField.ELLIPSIS | LabelField.FIELD_HCENTER);
.
.
.
        EditField sell = new EditField("Selling Price: $", "", 10, EditField.FILTER_REAL_NUMERIC | EditField.FIELD_RIGHT);

        EditField taxrate = new EditField("Tax Rate: ", "", 5, EditField.FIELD_RIGHT | EditField.FILTER_REAL_NUMERIC);
.
.
.
ButtonField button = new ButtonField("Calculate Payment", ButtonField.FIELD_HCENTER);
        CalcButtonListener calculate = new CalcButtonListener();
        button.setChangeListener(calculate);
.
.
.
 final class CalcButtonListener implements FieldChangeListener {
        public void fieldChanged(Field field, int context) {

        String sellData = sell.getText();
        float sellVal = 0;
        if (sellData != null && sellData.length() > 0) {
            sellVal = Float.parseFloat(sellData);
        }
        String taxrateData = taxrate.getText();
        float taxrateVal = 0;
        if (taxrateData != null && taxrateData.length() > 0) {
            taxrateVal = Float.parseFloat(taxrateData)/100;
        }

        total = sellVal * taxrateVal + sellVal    

            LabelField newpmt = new LabelField("Total: " + total, LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH) {
            public void paint(Graphics g) {
                int x=  g.getColor();
                g.setColor(Color.GRAY);
                g.drawRect(0,0,this.getWidth(), this.getHeight());
                g.fillRect(0,0,this.getWidth(),this.getHeight());
                g.setColor(Color.WHITE);
                super.paint(g);
            }
        };
        setStatus(newpmt);

        }
    }

Nevermind, I figured it.  I forgot to set them in my code.

Tags: BlackBerry Developers

Similar Questions

  • Pass a variable to the main class to a MovieClip

    Hello!

    I have a document with the main class.

    I have also a few clips that have their own class and functions.

    I'm trying to pass a variable in my main class to one of these clips.

    I tried a few things, nothing has worked.

    Who can help?

    Match_Easy looks like a class name.  You must use the name of the instance.

  • Could not load the manifest attribute of the main class of C:\program files\frostwire\commons - connect

    original title: I need to know what means this message and I can remove it from my computer

    doess someone knows what this message means? Could not load the manifest attribute of the main class of C; \program files\frostwire\commons-logging, pot every time I look at this subject in my file, it appears, I'm not good at all with computers but I know im short-term memory or space on this computer and I tried to go into my programs and delete, can you please help me understand what I can and can not delete to give me more space? Thanks, im running Windows Vista! If you would like more information, I'm sorry, just ask me? Thanks again, I hope someone can help me! :(

    This discussion forum on Microsoft Security Essentials antimalware. You can get help in the Microsoft Vista answers forums - http://answers.microsoft.com/en-us/windows/forum/windows_vista

    Jim

  • "Could not find the main class" Java error on Windows 7, but not Windows XP

    Hi all

    It's the first app I try to package and virtualize with ThinApp.

    It is an old business application that usually runs on Windows XP SP3 x 86.

    The. MSI that I generated with Thinapp works very well when it is installed on a Windows XP SP3 x 86.

    However, our main goal to use Thinapp is to install on a Windows 7 SP1 x 64.

    But in doing so, the application triggers a Java Virtual Machine Launcher error message saying: "could not find the main class. Program will exit. »

    I thought that it was because the app includes a 1.4.2 JVM and that my XP has not any JVM pre-installed, but the main image on my W7 has a 1.7 JVM. But even after I uninstalled the 1.7 and installed JVM 1.4.2 on the W7 machine, I kept getting the error message so I guess that it is not bound.

    Y at - it an option that I missed during my MSI generation so that it can run on a Windows 7 x 64?

    Thank you all for your help.

    D.

    With the help of Lachi, we found that the app natively works on W7, no need for ThinApp it if the goal is just to make it work on W7, from a XP world.

    The only change we had to make (and the error was the same ThinApp-ed, which is what I originally shared) is that the application should work with Windows 7 in "classic" mode "of the screen (without Aero and the menu start XP-style). This is because the application runs an old integrated version of Java (1.4) and it makes the system calls seeking specific .dll to display, which are not accessible by default if Aero is enabled.

    Closed topic

  • How to set a variable in the main timeline of in a symbol?

    Just get started with Animate and coming from Flash, it may be apparent to my question. How do you define a variable for the main timeline of in a symbol?

    I have 24 pairs of clickable elements, each in their own symbols, and 24 of these symbols to sit inside another symbol. I want every 24 to set the global variable even when you click on it. I do not find that this question is anywhere, which makes me think that I can be stuck in a mentality from Flash and approaching the task in a bad way. (However, there are MANY discussions address showing how objects to different levels in the hierarchy.) Which is well covered).

    By the way, how to access a function on the main timeline of in a symbol?

    Adobe should consider putting on foot (or pages) support just for people migration form Flash. In the documents that I've met so far there seems to be a studied effort to refrain from mentioning Flash somehow. I imagine that there are many people out there like me who have a deep background in coding Flash, but start with Animate. We don't need help with most of the basic concepts, but we still have some pretty basic questions on how to achieve certain things in Animate because our knowledge of Flash gets in the way.

    Hi Bill,

    There are a lot of discussions here on the scope, but here's a way to create a global variable:

    code on Stage.compositionReady

    sym.myGlobalVar = 1;

    Then, anywhere in your project, you can check/set this var as follows:

    sym.getComposition () .getStage () .myGlobalVar = 2;

    And here is a way to create a global function:

    code on Stage.compositionReady

    sym.myGlobalFunction = function() {}

    Console.log ('myGlobalFunction');

    }

    Then, anywhere in your project, you can call this function as follows:

    sym.getComposition () .getStage () .myGlobalFunction ();

  • error message "cannot load the main class.

    I ran windows update yesterday and installed the recommended updates, restarted my laptop today the error message "Unable to load the main class" appears in a box and I couldn't do anything until I had closed this box, after the loading of firefox it displays a message not responding, then a bar indicating that plugin adobe did not start successfully so I clicked to reload page Then, I rebooted my laptop to see if this solves the problem, but the same error message appeared and firefox have responded in the same way, someone has an idea how I can fix this problem?  I run anti-virus software and malware from comodo and my OS is windows vista 32. I also downloaded an update for adobe flash yesterday but the problem has not produced until after I had done the updates of windows.  Thank you

    Hello Fiona,

    Thank you for your response.

    You are facing this problem might because of Java program on your computer.

    I suggest you perform the clean boot and check the status of the issue, which will help you identify the problem.

    Keep the computer in a clean boot and check the status of the issue. If everything works well after a clean boot, you can deduce that some third-party services are at the origin of the problem. Continue with the remaining steps to pin-point on the third party service. After find you the program that is causing the problem, you will have to perhaps to update or install a newer version of the program, if you rarely use that you should consider uninstalling the software.

    How to perform a clean boot for a problem in Windows Vista, Windows 7 or Windows 8.

    http://support.Microsoft.com/kb/929135

    Note: please go through the section:How to reset the computer to start as usual after a clean boot troubleshooting section of Kb to start the computer to a normal startup after you fix the problem.

    Hope his helps.

  • How to pass Variables from the Source (SQL) to tab target (JavaBin Shell) in ODI knowledge Modules

    Hi all

    My name is Alessandro and I am new to the community.

    I have a problem with the KM stage custom when I try to pass the variable from the source to the target.

    The ODI version tha I use is the 11.1.1.5.0.

    I created a stage KM following the instructions of the metalink document (Doc ID 728636.1).

    But when I insert the value of the variable in a test table, the value in a table is the name of the variable.

    Where I'm wrong?

    I am doing thi.

    (1) create a step in my goal of shell sql source and javabin KM. In the source tab I get the value of a query, and the name "LAST_UPDATE" column.

    In the target tab, I attribute to the variabile jv_last_update the value of the variable #LAST_UPDATE, with the same name in the selection column.

    source_tab.jpgtarget_tab.jpg

    (2) I created a second stage where I insert into a table of the value of the variable jv_last_update (to debug the value of the variable):

    insert_step.jpg

    (3) when I try to see what I have in the table, the value of any line is the name of the variable "#LAST_UPDATE"; ".

    result_table.jpg

    Thanks in advance


    Alessandro

    Hi Alessandro,.

    Interesting... I have not read the Oracle document you sent yet, but one thing I can guarantee you, is that it doesn't. If Oracle says that it should work, maybe it's a bug, or maybe he has changed on new versions of ODI. I am also on ODI 11.1.1.5 and I tried many different ways to pass SQL results to variables of java with all sorts of different labels, but none of them worked for me as well. But I managed to use it in a different way, so please see below if it matches your needs:

    We are just one step. The second is just to show that it worked:

    In the first step, on the source tab, select Oracle and point to the logical schema that you want to run the query:

    On the target, note the following Java BeanShell code with the SQL that you want to run:

    Now your variable must have the correct value of your SQL. To test it, I just write a comment 'Raise' to Jython in the second step:

    The result is 'X' as expected:

    It will be useful.

    Thank you!

  • How can I access a variable on the main timeline of a movie nested in HTML5 Canvas

    Hello

    This should be pretty simple, but for some reason, it does not work if I have the wrong syntax.

    But I have a movie clip with a bit of code in it.

    It is a timer.

    I want to be able to program the wait time: since the main scenario and that the timer read this variable on the main timeline.

    I implemented the delay var = 1000 on the main timeline, but then I do not seem able or knows how to get this variable in my code in the nested MC. It is quite difficult to find the reference of the paradigm flash timelines on H5 support pages, so I really appreciate the help.

    tl2 var = this;

    TL2. Stop();

    var delay = delayMain;

    var startTime is createjs. Ticker.getTime ();

    createjs. Ticker.addEventListener ("tick", f);

    {function equation

    If (createjs. Ticker.getTime () - startTime > delay) {}

    TL2. Play();

    createjs. Ticker.removeEventListener ("tick", f);

    }

    }

    If you want to get to a variable defined by a feature any at any depth, you can use the window. As:

    Window.Delay = value;

    in a deeply buried movieclip, can be read in any other level of the project.

  • Storage of source files separate from the main site files

    Hello

    I use Dreamweaver CS6.

    Is it possible to set up a site definition to store files source (EG. Files Photoshop etc.) on a separate FTP, away from the main site files.

    I try to avoid having to configure site definitions 2 if possible to keep things tidy.

    So the end result would be something like this:

    Site files get downloaded on ftp.mysite.com

    and

    The contents of the folder _source gets downloaded on ftp.mysource.com

    Thank you.

    You can use an FTP 3rd party like FileZilla client to transfer files from the source to a different location on your server.

    Nancy O.

  • The main class is not found: HelloWorldSwing

    First lines of the file "HelloWorldSwing.java".
    package start;
    import javax.swing.*;
    public class HelloWorldSwing {
    I've successfully compiled the file.
    When I type the following command
    C:\>java HelloWorldSwing
    I get the following error Message:
    Could not find the main class: HelloWorldSwing.  Program will exit.
    I'm sure that the absolute path of the file is:
    C:\start\HelloWorldSwing.Java
    and I issued the command of
    C:\

    Your class is in a package. Its fully qualified name is start. HelloWorldSwing

    DB

  • Sent by second Outlook identity received from the main identity

    Hello Mozilla Community,

    I use Thunderbird 31.8 (1:31.8.0 + build1 - 0ubuntu0.14.04.1) on 64-bit Linux Mint 17.2 and I'm trying to set up a second identity for my Outlook account.

    I have two identities configured as an alias in Outlook, and I used both via the web client for a long time. I have the account set up in Thunderbird (IMAP, SMTP) with the main identity works very well.

    Now, I'm trying to configure the alias second in Outlook as identities in Thunderbird just to send email from the identity of the second. I configured the second identity with a name and the same email address that I have as an alias in Outlook, leaving the other default options (because they are ok for me).

    I did several tests, send emails from two identities to a gmail account that I have (and it is also configured in Thunderbird). The main identity works well but the e-mail sent by the second identity is received on the account of gmail from the main identity.

    I looked in the folder "Sent" to the Outlook account (in Thunderbird) and there are 2 emails saved for each test with the second identity: the one that says it's main identity and another who says he is the identity of the second.

    Any help would be appreciated.

    P.S.: I have sought the support of Mozilla and also google about it, without success.

    Outlook identities DO NOT WORK WITH E-MAIL CLIENTS. It's all e-mail clients, just bot Thunderbird

    Initially, I wrote an article in the knowledge base on the subject (which I need to change seriously now, I guess...) Could I interest you in this Toad?)

    No matter what you set up in your e-mail client, Outlook will converted as it passes through the SMTP server of your primary identity. They are unashamedly on the subject and claim it as a kind of safety device. But Microsoft were claiming bugs as features since the mid-1980s

  • Y510 unable to get data from the camera.

    Hello

    I have a Y510 with Windows Vista 32 bit, 3 GB RAM, only 5 weeks. I get this message when I try to use Veriface, "unable to get data from the camera. The camera may have been disconnected or busy. I reinstalled Vista of the State in which the laptop came, but it does not work. I also updated the bios and install other updates were available. I would appreciate any advice.

    Thank you

    Peter

    I wish it was as easy as press Fn + Esc, I looked through an another Y510 our office and managed to find a process that must be set to Auto, the process is KtmRm. This process cannot be disabled, handicapped, or on a time delay, it must be AUTOMATIC.

  • OfficeJet Pro 8600 not giving orientation options when printing photos from the main tray

    Greetings, all.

    I searched this issue, but I have not found anything, so this is:

    I have an OfficeJet Pro 8600 911 and an iMac (21.5 inch, end 2013) running OS X 10.9.2 Mavericks.

    The problem comes when I try to print a photo 4 x 6 from the main drawer - in the print dialog box, the image is oriented the wrong way on the preview. No matter if I rotate the image or not, it does a perpendicular orientation. In the print dialog box, there is no orientation option to change from portrait to landscape or vice versa, even if

    I checked the software update of the Mac and the Pro 8600, but there is nothing available.

    I am pleased to learn that the Preview will allow you adjust orientation, at least, we know that this is possible. Apple is the one controlling the features such as that within the application. Click here: view contact information of apples. Apple Support Forums are also available here:

    Kind regards

  • Photosmart premium will not print from the main tray

    I have a HP Photosmart Premium.  It won't print or copy from the main tray.  Despite the fact that I specifically designated main tray settings, he continues to try to print from the photo tray. How can I fix it?

    My recommendation would be to define the default values for what you do most often.  You can assign the parameter of the bins to automatic and the printer should draw the correct tray based on the other parameters of size and type of media.  If you experience problems with the automatic selection of tray for a particular document or a picture, you can specify the drawer wished for this print job.

    I'm a link the User Guide for your printer.  Click here  I thought you might find useful.

  • I keep getting messages from the center of Action McAfee Anit-virus, Anti-spyware & firewall disabled, as well as Windows Firewall

    It started after a message popped up on Adobe Reader and I deleted it.  I tried to run applications without success.

    Hello

    Welcome to the Microsoft Community and forums thanks for posting the question. According to the description, you get messages from the center of the Action as McAfee and the Windows Firewall is disabled.

    Please answer a few questions to refine the question.

    1. you remember to make changes to the computer before this problem?
    2. you have more of a security software installed?
     
     
    Anti virus definitions update and check the status
     
     
    Method 1: I suggest you to enable and disable the Security Center
    service in Windows 7:
    a. click the Start button, type services.msc and pressenter.
    b. in the list of Services, right click on Security Center, clickingProperties
    and select disabled.
    c. restart your computer.
    d. once again, follow steps a and b, and then select Automatic (delayed start)
    e. start the Service.
     
     
    Method 2: You can uninstall and reinstall the security software and check.
     

    Method 3:

    Restore the system to an earlier point before installing this application.

    System Restore can return your files system to a point in time before you noticed a problem, without affecting documents, photos, or other personal files. If the system restore does not resolve the problem, you can undo the restore operation and choose a different restore point.

    More information on:

    System Restore: frequently asked questions
     
    Hope this information helps. Please reply with the status so that we can help you.

Maybe you are looking for