How to use TextField to add two numbers and show the result.

hi everybody
i would like to use JTextField to get addtion of two Numbers,
for example i am trying to type any integer numbers in JTextField like 7
and press JButton, called( +) to add anthor number like 7 and press JButton called(=) to get addtion fo
7 + 7 = 14, at same JTextField.
so there will be two buttons, one for (+),other for (=).
i have implement ActionListener in (+) button ,to get Text from JTextField (with getText() method),
now how do i use same getText() method to get the next number that i will add it with previous number in
(+) button and get the result whenever i press (=).
1-type integer number like (4) in TextField.
2-press addition button(+) to get text by using getText() method and clear TextField.
3-type anthor integer number like(6).
4-press (=) button to get the number (6) by using getText() method, calculate 4 + 6 and show the result at same TextField (10).
i hope it is so clear
thank u in advance for any advice and suggestion.

Use your first button to
String x = JTField.getText();
int y = Integer.parseInt(x);
this will get your first value on your + button. Make sure you initialise the int beforehand incase nothing is put in (ie error prevention) then clear the JTField prob using setText(""). Repeat the process for the = button using different variables and add them normally and output the result.
If your putting more than 1 arithmetic button on the GUI then you'll need to distinguish between them!!!

Similar Messages

  • HT201412 while using sometimes my iphone 5stops working and shows the apple logo with white background for 5 seconds and in short time it returns to home screen.please solve it

    while using sometimes my iphone 5stops working and shows the apple logo with white background for 5 seconds and in short time it returns to home screen.please solve it

    Hi there bencong111,
    You may find the troubleshooting steps in the article below helpful.
    iOS: Not responding or does not turn on
    http://support.apple.com/kb/TS3281
    -Griff W. 

  • How to upload Images to azure media services and show the image on on click on Link?

    Hi,
    I want to upload the image to the Azure media service asset and show the Link on the page. When use clicks on the Link I want to show it user. How can I implement this with C#? Now I am uploading the image to asset as in the normal way and getting the URL
    for that. But I am not able to show it user when he click on the image link.
    Thanks,
    Pavankuamr H K

    HI
    Azure media services has a RESTful service and a C# SDK that you can use to interact with the Azure Media Services.
    Here is the documentation and sample code for calling the Media services and using the SDK:
    https://msdn.microsoft.com/en-us/library/dn735908.aspx?f=255&MSPPError=-2147217396
    Aram Koukia | Blog: koukia.ca | Twitter:
    @aramkoukia

  • How to convert Smart Form into PDF format and return the result in BAPI?

    I want to convert a Smart Form into PDF format and return the result in BAPI.
    can anyone tell me how it can be done with related example
    regards
    pranay

    hi,
    smart form to pdf--
    All you have to do is call your SF to get OTF and then concert it to PDF. Works like charm:
    DATA: p_output_options TYPE ssfcompop,
    p_control_parameters TYPE ssfctrlop.
    p_control_parameters-no_dialog = 'X'.
    p_control_parameters-getotf = 'X'.
    CALL FUNCTION v_func_name "call your smartform
    EXPORTING
    output_options = p_output_options
    control_parameters = p_control_parameters
    IMPORTING
    job_output_info = s_job_output_info.
    call function 'CONVERT_OTF_2_PDF'
    tables
    otf = s_job_output_info-otfdata
    lines = t_pdf
    and if u need more u can check below links also
    Check the below links..
    Re: Smartforms to PDF
    Re: smartform (otf) as pdf and sending as email-attachment
    VISIT THIS LINK
    Re: Smartforms to PDF
    PLZ REWARD POINTS IF IT HELPS YOU
    rgds
    anver

  • How to join two lists and display the results in datasheet view.?

    hello,
    i have two lists that i would like to join, i know a method that has been described  in the link below
    http://www.codeproject.com/Articles/194252/How-to-Link-Two-Lists-and-Create-a-Combined-Ciew-i
    however, here the data view is only limited to 30 rows and my resultant list is huge. I would like to know if there is a possibility to view the resultant list in a data sheet view ?

    I don't believe you can use the OOTB Datasheet view when joining lists. However, you should be able to increase your limit from 30 items to as many as you need (that doesn't trip the threshold set in Central Admin).
    Dimitri Ayrapetov (MCSE: SharePoint)

  • How do I paste a hyperlink into the new version of Numbers and show the link name rather than its URL?

    I used to be able to do this using paste and match style, but now instead of showing the link name as on the website of origin it is pasting the whole URL. thanks

    Hi Debbsy,
    Hyperlinks in Numbers 3 are a bit of a mystery. However, here is one way that works.
    https://discussions.apple.com/thread/6630204
    Debbsy's question
    For example, the URL to this thread in Cell A2
    https://discussions.apple.com/thread/6630204
    In Cell B2, insert the HYPERLINK function
    =HYPERLINK(A2,"Debbsy's question")
    Hide Column A.
    Regards,
    Ian.

  • How to search XML data from a HTTPMultiService and display the result on the Spark List

    Hello all,
    I am totally new to Flash Builder and Actionscript and hope someone might be able to help me out. I basically create a mobile app with a single view. The view has a TextInput as a search box and a search button. I conntected a Data/Service using a local XML file and bind the Data to a Spark List. Innitally the List will show nothing until the user enter the search term and hit the button. The List suppose to show the XML data that match the search term.
    Now is my problem. I cannot make the List to show the data that match the search text. The List just shows ALL the data.
    Here are my MXML code:
    <?xml version="1.0" encoding="utf-8"?>
    <s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
            xmlns:s="library://ns.adobe.com/flex/spark"
            xmlns:shopping="services.shopping.*"
            title="Search">
        <fx:Script>
            <![CDATA[
                import mx.events.FlexEvent;
                protected function button1_clickHandler(event:MouseEvent):void
                    navigator.popView();
                protected function list_creationCompleteHandler(event:FlexEvent):void
                    getDataResult.token = shopping.getData();
                protected function seach_clickHandler(event:MouseEvent):void
                    getDataResult.token = shopping.getSearchData(searchTxt.text);
            ]]>
        </fx:Script>
        <fx:Declarations>
            <s:CallResponder id="getDataResult"/>
            <shopping:Shopping id="shopping"/>
            <!-- Place non-visual elements (e.g., services, value objects) here -->
        </fx:Declarations>
        <s:actionContent>
            <s:Button height="79" label="Back" click="button1_clickHandler(event)"/>
        </s:actionContent>
        <s:List id="list" left="0" right="0" top="111" bottom="0"
                creationComplete="list_creationCompleteHandler(event)" labelField="english">
            <s:AsyncListView list="{getDataResult.lastResult}"/>
        </s:List>
        <s:TextInput id="searchTxt" x="80" y="34" width="250" height="49" enabled="true"
                     prompt="search..."/>
        <s:Button id="search" x="338" y="35" width="72" height="49" label="s"
                  click="seach_clickHandler(event)"/>
    </s:View>
    Here is the _Super_Shopping.as file:
    * This is a generated class and is not intended for modification.  To customize behavior
    * of this service wrapper you may modify the generated sub-class of this class - Shopping.as.
    package services.shopping
    import com.adobe.fiber.core.model_internal;
    import com.adobe.fiber.services.wrapper.HTTPServiceWrapper;
    import com.adobe.serializers.xml.XMLSerializationFilter;
    import mx.rpc.AbstractOperation;
    import mx.rpc.AsyncToken;
    import mx.rpc.http.HTTPMultiService;
    import mx.rpc.http.Operation;
    import valueObjects.Shop;
    [ExcludeClass]
    internal class _Super_Shopping extends com.adobe.fiber.services.wrapper.HTTPServiceWrapper
        private static var serializer0:XMLSerializationFilter = new XMLSerializationFilter();
        // Constructor
        public function _Super_Shopping()
            // initialize service control
            _serviceControl = new mx.rpc.http.HTTPMultiService();
             var operations:Array = new Array();
             var operation:mx.rpc.http.Operation;
             var argsArray:Array;
             operation = new mx.rpc.http.Operation(null, "getData");
             operation.url = "assets/data/shopping.xml";
             operation.method = "GET";
             operation.serializationFilter = serializer0;
             operation.properties = new Object();
             operation.properties["xPath"] = "/::shop";
             operation.resultElementType = valueObjects.Shop;
             operations.push(operation);
             operation = new mx.rpc.http.Operation(null, "getSearchData");
             operation.url = "assets/data/shopping.xml";
             operation.method = "GET";
             operation.resultFormat = "text";
             argsArray = new Array("item");
             operation.argumentNames = argsArray;
             operation.properties = new Object();
             operation.properties["xPath"] = "/::shop";
             operation.resultElementType = valueObjects.Shop;
             operations.push(operation);
             _serviceControl.operationList = operations;
             preInitializeService();
             model_internal::initialize();
        //init initialization routine here, child class to override
        protected function preInitializeService():void
          * This method is a generated wrapper used to call the 'getData' operation. It returns an mx.rpc.AsyncToken whose
          * result property will be populated with the result of the operation when the server response is received.
          * To use this result from MXML code, define a CallResponder component and assign its token property to this method's return value.
          * You can then bind to CallResponder.lastResult or listen for the CallResponder.result or fault events.
          * @see mx.rpc.AsyncToken
          * @see mx.rpc.CallResponder
          * @return an mx.rpc.AsyncToken whose result property will be populated with the result of the operation when the server response is received.
        public function getData() : mx.rpc.AsyncToken
            var _internal_operation:mx.rpc.AbstractOperation = _serviceControl.getOperation("getData");
            var _internal_token:mx.rpc.AsyncToken = _internal_operation.send() ;
            return _internal_token;
        public function getSearchData(item:String) : mx.rpc.AsyncToken
            var _internal_operation:mx.rpc.AbstractOperation = _serviceControl.getOperation("getSearchData");
            var _internal_token:mx.rpc.AsyncToken = _internal_operation.send(item);
            return _internal_token;
    The getSearchData() supposed to return XML data that match the search text, but it doesn't. Can anyoen help?
    Thank you!

    Hi,
    are you able to change dynamically the  operation.url = "assets/data/shopping.xml";?
    i need to do that based on the users input.
    Thanks in advance,

  • How can I export photos from my Iphone and show the filming time

    I tried to export my photos from my iphone, but the times of them are created time and modified time, how can they show the filming time?

    I tried to export my photos from my iphone, but the times of them are created time and modified time, how can they show the filming time?
    How are you trying to view the times of the photos? On a Mac you cannot see the capture date of a photo in the or video in the Finder.  The Finder will always show the date the file was created or modified, and not when the photo has been taken. The capture date, when the iPhone took the photo will be encoded in the EXIF tags of the file, and that is different from the file creation. Photo software will show you the EXIF, the Info panel in iPhoto, or the Info panel in Preview.

  • Subtracting two timestamps and showing the number of hours between them.

    Hello Folks,
    What I have is two tables, each of them has a timestamp column. I want to do a select with a join that will show a column with the number of hours between the two times.
    (I have added the columns as timestamp(0) since I have no need for the decimals)
    Here's what I have:
    table one name: conc_test
    table one info:
    P_DATE-------JOB_NO-----MIX---POUR_NO----AMB_T---CONC_T--SLUMP---AIR---DENSITY---CYL_CAST_TIME
    09-MAR-10---9-12-796-----80----100309A------2.5--------16----------135------2.5----2501-------09-MAR-10 10.00.00 AM
    table two name: rls_break
    table two info:
    JOB_NO----POUR_NO-----CYL_ID----SPEC_STR---STR----MIX---BREAK_D_T
    9-12-796---100309A----100309A1------20-----------27-----80----10-MAR-10 07.15.00 AM
    (I put the --- between the columns so it would be more legible for forum reading, fyi)
    This is what I was trying to do:
    select
    rls_break.cyl_id "Cylinder ID",
    rls_break.mix "Mix",
    trunc(rls_break.break_d_t-conc_test.cyl_cast_time) "Age",
    rls_break.spec_str "Specified Strength",
    rls_break.str "Specimen Strength"
    from rls_break inner join conc_test on rls_break.pour_no = conc_test.pour_no
    where pour_no = '100309A';
    I want the "Age" column to show the total number of hours between the cast time (column cyl_cast_time from conc_test) and the break time (column break_d_t from rls_break)
    Thank's for any and all help.

    (I put the --- between the columns so it would be more legible for forum reading, fyi)Please put the tag before and after your examples.
    See: http://forums.oracle.com/forums/help.jspa for more information reagarding tags. (scroll a bit down)
    I want the "Age" column to show the total number of hours between the cast time (column cyl_cast_time from conc_test) and the break time (column
    break_d_t from rls_break)
    Do a search on 'NUMTODSINTERVAL' or 'time difference' on this forum, you'll find many related examples.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • How to use one app on two different devices so the info is the same...not having to start from level 1 again on new device

    Hi there,
    I have an app which I have recently achieved level 16 on (stored on ipod 4)...I have just purchased an iphone4s and would like to download the app to my iphone to play on there so I can play it anytime and not just at home when connected to wifi. When I downloaded it to my iphone it started me from level 1 again so I deleted it off and have tried several different ways to install the info syned from ipod without success...if this is not possible please advise...however I have been successfull with other games in having them show on both. I am afraid to delete it off itunes as it says it will delete it off the ipod when next synced.
    Kind regards
    Extremely frustrated individual
    Amy

    You're looking for something that's called a reverse web proxy.  That'll require some manual configuration within Apache, as it's not supported natively by Server.app tool.
    The other option is to have your "primary" host just fetch and display the web data from the other host — nothing requires the contents of a web page all be from the local host, after all.
    Another potential option is to configurre for and VPN into the network, and you can then access the network locally — this assumes you're the primary consumer of the reverse proxy, and not "the world".
    Related here and here and probably a few others; remember that the configuration files in Mavericks are located under /Library/Server/Web now.

  • How to use cfdocument  create a PDF file and save the file in server?

    Hi,
    I want to use cfdocument to create a PDF file and save it in
    the server for other people to download,can you give me a idea how
    to do this.Thanks.
    <cfdocument format = "PDF" pagetype="A4"
    orientation="portrait">
    </cfdocument>
    Mark

    Hi
    <cfdocument filename="" format = "PDF" pagetype="A4"
    orientation="portrait">
    </cfdocument>
    Give the physical path to the filename. You have write
    permission for this folder to create a PDF file.

  • How to communicate between Flex and JSP and show the result in an Iframe

    Hi all
    I am trying to send some data from flex to one HTTPService and trying to show the same response jsp in an Iframe. But unfortunately i am unable to get the responce Jsp's url to set as a source for iframe.
    let me explain you clearly...I have a mxml where i am having a text box and a button in the left panel and in the right panel i am having an Iframe to display jsp. So once user enters some value in the text box and clicks button then HTTPservice's send method will be called with text box's content as an arguement. So i can fetch that value from request object in jsp and display the value in jsp. So the problem here is i want display that result jsp in my Iframe. I know that , we need that result jsp URL to display in Iframe . But as i am sending POST request to HTTPservice, i am not able to get the result jsp's URL in flex side.
    So i need help desperately from great minds.So anyone of you can give me some suggestions!!!!
    Regards

    Hi all can some one please give a solution ...Any suggestions would be greatly appreciated

  • Write a class to add two numbers

    Hi guys,
    Just trying to write a simple program that allows a user to input two numbers then get the result and display it. Im getting 3 errors at the momment
    one at total and the other two at keyboard.readInt, can anyone see anything obvioulsy wrong please
    <java>
    public class Add
    public static void main (String [] args)
    int number1;
    int number2;
    int total =0;
    System.out.println("please input a number");
    number1=Keyboard.readInt();
    System.out.println("please input your second number");
    number2=Keyboard.readInt();
    total=number1 + number2;
    System.out.println("the total is" (total));
    </java>

    I have a feeling you copied someone else's code and don't know how to use it. You don't want to use readInt(). That's described in the DataInput Interface as "Reads four input bytes and returns an int value". What you want is a BufferedReader.
    BufferedReader Keyboard = new BufferedReader(new InputStreamReader(System.in));
    then,
    String line = Keyboard.readLine();
    int numberA = Integer.parseInt(line);

  • How to enhance DEBMDM06 to add custom segments and do mass message transf

    Hi Team,
    I have a requirement to transfer multiple IDocs(Customers) as a single IDoc to PI (Earlier XI) system. As I know this could be done by doing necessary config in ALE and execute the transaction MDM_CLNT_EXTR(MDMC specific to customer master day) by creating a variant with proper Extraction Object details. This works perfect with only standard idoc type DEBMDM05/06.
    1. I have extended the IDoc type DEBMDM06 to ZEUDEBMDM06
    2. Created a new message type ZDEBMDM (using WE81)
    3. Assigned the message type to IDoc type(using WE82).
    4. Created a new extraction object ZCUSTOMER_EXTRCT from CUSTOMER_EXTRACT by executing
        program 'MDM_METADATA_MAINTAIN'.
    5. Maintained the view 'VMDMMETA' using SM30 to add custom segments and altered the positions according to new IDoc type.
    6. Found a user exit to fill custom segments.
    7. Executed the transaction MDMC, in the debug managed the hord coded extraction object from 'CUSTOMER_EXTRACT'
        to 'ZCUSTOMER_EXTRCT'.
    This has generated a single IDOC for 2 customers but ulike one segment for one customer, it has addes somany segments at same level.
    Can we enhance the mass message transfer concept so that we can use it for extended IDOC type so that I can have custom segment types added ?
    Thanks in advance...
    Arun
    Edited by: Arunkumar Ponnoju on Sep 8, 2009 11:31 AM

    hi Caíque  ;
    Firstly thanks for your answer.But your badi is at CRM side, I want to fill BDOC with custom fields from ECC to CRM when I changed them in IE02 of ECC.
    Do you know there is any badi after BDOC is filled in ECC.
    Regards.

  • How to create the Vote Form and Get the Result

    I have an assignment to create a website for voting and show the result online.  Anyone can tell me the steps to build such website???

    This tutorial uses jQuery and PHP
    http://code.tutsplus.com/tutorials/creating-a-dynamic-poll-with-jquery-and-php--net-57
    Nancy O.

Maybe you are looking for

  • Cannot add features to windows 8.1 single language

    When i tried to update from windows 8.1 single language to windows 8.1 professional, the add new feature application in my windows came up with an error saying, process could not be completed, contact support. I already have my key, but now I cannot

  • How to make the Infotype as mandatory

    Hi All,          I need to make the Infotype as mandatory. E.g., In PA40,  the user should not skip the screen without entering the data in the infotype. How can i make it. Thanks Yogesh

  • ITunes gift card money disappeared?? Help!

    So I was trying to rent a movie off my desktop Mac computer which already had $15.00 gift card money on there. The money was next to my account name and everything! When I tried to rent the movie, a window popped up telling me to "authorize the compu

  • Need to Reinstall my OS, How Can I Deactivate Freedome?

    I purchased a 5 device licence of Freedome...and I have used 2 on 2 iPhone's, 1 on my iPad and 1 on my Mac. However I recently re-installed Freedome on my Mac and it used the 5th licence?? I'm not too fussed about that ....since I only have 4 devices

  • Song selected....but nothing plays.....please help

    My iPod over the last few weeks has started to go bugger up, and the new problem is that when i turn on my iPod and select a song it will open the now playing view, but then the song will just sit (as if paused) but not play. then after a few seconds