How to combine integers with JTextFields?

Hello
I have 2 textFields and i want to add on each a integer
I also have 3 buttons 1for the "+"function 2 for the "-" function and 3 for the "="
function
How can i put integers and make the above functions using (JTextFields which are working with Strings as far i know)without throwing me exception thread String needed?
thanks

Why not just set the text to whatever number you want (or have the user do it by typing in the JTextField), then use getText() to retrieve the text and do your operations on it?
User enters stuff into textfields
User hits "enter" (or whatever)
Use JTextField.getText()
Use Integer.valueOf(String)
etcOr whatever floats your boat.

Similar Messages

  • How to combine rows with small numbers into single "other" row?

    How can I combine rows with value 6(for example) or lower to single row representing the SUM of all this values and label OTHER, so the pie chart will have a chance to display all small values combined?
    I'm using Numbers 09

    HI Peter,
    When you write a decimal number, is the decimal separator a period ( . ) or a comma ( , )? If it's a comma, then the syntax error can be corrected by replacing the list separator in the formula, a comma in Jerry's formula, with a semi colon ( ; ):
    =SUMIF(B; "<6"; B)
    (Added): The two Bs appear in blue 'lozenges' in Jerry's image because that is the way cell (or column) references are displayed in Numbers when a formula has correct syntax.
    Regards,
    Barry
    Message was edited by: Barry

  • How to combine TrivialPageFlowEngine with JAZN XML-based provider ?

    With help TrivialPageFlowEngine possible will limit access to pages, and also to set pages for logon. However, JAZN XML-provider provides the same functionality. How to combine these two approaches

    Rustam,
    can you help me with "TrivialPageFlowEngine"? Where can I get documentation for it to have a quick lokk before replying to your request. Oracle9iAS JAAS (aka JAZN) is based on the Java Authentication and Authorization Service and implements it's own provider.
    If you look in the OC4J demos for jazn, there are two samples explaining how to setup JAZN (If installing OC4J with Oracle9iDS or Oracle9iAS then jazn already is defined to be the default provider).
    If e.g. you use Oracle9iAS and configure (and deploy) a Servlet for basic authentication, then this automatically is performed by the Oracle Single Sign-on server (if configured for OID) or direct jazn-data.xml (if not using OID). All your code needs to do is to get the authenticated principal's name.
    From your posting it is not clear if you require authentication or authorization alike. Authorization requires permission classes to be written and assigned.
    Fran

  • How to combine BOMs with Free Goods?

    Dear all.
    I am currently working on setting up a retail store in SAP ERP (6.0). Our client requires from us creating a functionality that would allow to create sets and add free goods to a certain set. For example: if you buy a set consisting of a hammer and a drill at a regular price, you get a pair of gloves free of charge.
    We used BOMs to create the sets and attempted to combine them with Free Goods, which prooved impossible -- FGs don't work with BOMs. We also tried to use Bonus Buys, but these seem to be working only with SAP Retail, which is not available to us.
    Do you know any way around this problem?
    Grzegorz

    Shantanu
    It sounds pretty helpful, however, what we just found out it is impossible to give away free goods according to the local tax standards - so we have to give them away for a fraction of the price rather than free of charge. This forced us to create a separate logic to deduce different item categories in a sales order and different prices according to that.
    Thanks anyway.
    Grzegorz

  • How to combine sound with video to an AVI Using IMAQ?

    I need to combine sound with video I capture and write it out as an AVI. Is there anyway in Labview to combine sound with and AVI? Or an easy to use third party product?

    Hello,
    The AVI tools that are provided with Vision allow for data to be added to your video.  Sound information can be stored this way, but if you are looking for a way to add audio support to your video (such that it will play the sound file when the video is played in Windows Media Player or other applications) you may want to look into finding a shareware or freeware product that can accomplish this.  LabVIEW does not have tools specifically targetted to this operation.
    Good luck,
    Robert

  • How to combine text with variable in process flow

    Hi,
    I have created a function that returns the environment that a process flow is running in, Production, Test or Development. I have been able to bind the output of the function into a variable in a process flow and bind the variable to the subject of an email activity. I'd like to go one step more and combine the value of the variable with some text to explain which step in the process flow generated the email. Is there a way to concatenate text to a variable or to add an OWB system variable? I've seen an example where the subject of the email is
    "Failed mapping <mapping name>"
    but I want my subject to be "PROD Failed mapping <mapping name>" where the "PROD" is from a process flow variable or function return value.
    Is this possible?
    Thanks
    Don Keyes

    Hi Don,
    you can perform this task with ASSIGN activity.
    For example, you have two variable V_ENV_TYPE (with type of environment) and V_TEXT ("Failed mapping <mapping name>"). Define additinal variable V_NEW_TEXT, bind Variable parameter of Assign activity to V_NEW_TEXT variable and define value in Assign activity as
    V_ENV_TYPE || ' ' || V_TEXTRegards,
    Oleg

  • How to combine HexByte with StringByte

    I have Hex string number, for example 1234. "" is equal to 2 bytes. Then I have a string, for example "HelloWorld", equal to 10bytes. In principle, the combination have to be 12 bytes.
    I want to combine them together and the result is given 1234HelloWorld, equal to 12 bytes. Meaning, the frist 4 charachters are still considered as HexString. How can I do that...
    I convert HexByte to string and combine them... but that gives the answer 14 bytes

    package util.encode.combine;
    import util.encode.convert.HexToByte;
    import util.encode.convert.toHexString;
    public class CombineByte {
         //Constructor
         public CombineByte() {
         //Method
         public byte[] merge (byte[] Array1, byte[] Array2) {
              StringBuffer Sbuff = new StringBuffer();
              //Calling constructor
              toHexString con1 = new toHexString();
              HexToByte con2 = new HexToByte();
              //Converting byte into hex-string --display purpose
              String printA1 = con1.convert(Array1);
              return outputArray;
         } // End of merge method.
              String printA2 = con1.convert(Array2);
              return outputArray;
         } // End of merge method.
              //Adding two string together & casing back to string
              Sbuff.append(printA1).append(printA2);
              String addString = Sbuff.toString();
              //Convert the output string into a byte array
              byte[] outputArray = con2.convert(addString);     
              return outputArray;
         } // End of merge method.
    } //End of class
              return outputArray;
              return outputArray;
         } // End of merge method.
         } // End of merge method.
    This class is the example which works perfectly well to combine 2 Hexbyte(Array1 and Array2). con2.convert(addString) give a result of OutputArray, which is HexByte.
    file:///usr/share/doc/HTML/index.html
    However if Array 2 is not Hexnumber...... For example, it the byte[] represent "HelloWorld".. My problem is how can modified to combine Array1 and Array2...(I still want Array 1 represent HexNumber).
    I've been tried to solve this for a couple of day, if someone know, could you please kindly tell me?
    Regard

  • How to combine apex with mail

    Hi,
    I know how to send an e-mail to someone registered in a database maintained with an apex-application, but now I want to store the message itself in my database. Or the other way: by typing the content in my application and sending it as message.
    Has anyone an example how to solve any of these ?
    Any reaction will be appreciated.
    Leo

    <p>Leo,</p>
    <p>These posts can help you:<ul><li>Mail from Application Express</li>
    <li>Mail from Application Express again</li></ul></p>
    <p>With kind regards,</p>
    <p>Jornica</p>

  • How to combine SurfaceImageSource with Media Foundation?

    Hi,
    I am using following walkthrough, it works just fine but don't know how to integrate with SurfaceImageSource as a singleton.
    https://msdn.microsoft.com/en-us/library/windows/apps/jj207074(v=vs.105).aspx
    Could you give me some advise, any document that relevant to this scenarios? I am new to this.
    Thanks and Best Regards,
    Weera

    Hello,
    You should be familiar with this sample from our previous conversations:
    Media engine native C++ video playback sample. This sample should give you what you need to render the video from the Media Engine onto a D3D surface. You should then be able to use D3D and XAML interop to integrate with the SurfaceImageSource.
    Keep in mind that with the SurfaceImageSource the XAML compositing stack handles when the frame is updated. Because of this is it very likely that you will see tearing of the video when mixing the Media Engine render with the SurfaceImageSource. Because
    of this it is not recommended.
    I hope this helps,
    James
    Windows SDK Technologies - Microsoft Developer Services - http://blogs.msdn.com/mediasdkstuff/

  • How to Combine Forms with .PDF files?

    Hello. Several employees at my company frequently generate reports which are then edited in Acrobat 7. Life was good in the days of Acrobat 5. Then something changed between Acrobat 5 and 6, making this virtually impossible.
    Then along came Acrobat 7. We rejoiced when we realized we could edit all but one table in Acrobat 7, and that one could be edited using ALCD 7. Now here's the rub:
    The tables are generated individually using Crystal Reports as the compiler. Separate .PDFs are generated for each table and edited in Acrobat or ALCD when necessary. When all editing is complete, the reports are compiled in one .PDF for printing/publication.
    The problem is that once we edit a table in Designer, it cannot then be merged with the other .PDFs.
    Is there anything we can do to get around this? Thanks!

    Hi Katherine,
    Unfortunately Designer creates an XFA PDF form, which is not inherently compatible with AcroPDF files. (Their internal structure is different.)
    You could try one or both of the following things and see if they work - I haven't the opportunity to test these just now myself, but this is what I would try..
    Option 1 - When saving the table in Designer, select save as type option of "Acrobat 6 compatible static PDF" option and try if this can be merged into the rest of the file.
    Option 2 - After completing all changes, see if you can set up a batch process in Acrobat professional to print the Design files back to AcroPDF format, and then merge into the bigger file.
    I hope this helps,
    Sanna

  • Help Me please How to combine one tab press and continuesly press on keyboard

    Hy all, I am new here... Btw I have a problem when I making a game Flash with action script 3,. I want to
    make my character move when the key helding and I want  my character attack
    with one tab press either ,.. how to make  it work?? please give me sample to make it ... Thanks before

    yea thats correct but.. how to combine it with continuesly press.. I have script like this :
    package
        import flash.display.MovieClip;
        import flash.events.KeyboardEvent;
        import flash.ui.Keyboard;
        import flash.events.Event;
        public class Main extends MovieClip
            var vx:int;
            var vy:int;
            var attack:Boolean=true;   
            public function Main()
                init();
            function init():void
                vx=0;
                vy=0;
                attack=false;
                stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDownF);
                stage.addEventListener(KeyboardEvent.KEY_UP, onKeyUpF);
                stage.addEventListener(Event.ENTER_FRAME, onEnterframe);
             function onKeyDownF(event:KeyboardEvent):void
                if (event.keyCode == Keyboard.LEFT)
                    vx = -5;
                    Player.gotoAndStop(2);
                    Player.scaleX = -0.3;
                else if (event.keyCode == Keyboard.RIGHT)
                    vx = 5;
                    Player.gotoAndStop(2);
                    Player.scaleX = 0.3;
                else if (event.keyCode == Keyboard.DOWN)
                    vy = 5;
                    Player.gotoAndStop(2);
                else if (event.keyCode == Keyboard.UP)
                    vy = -5;
                    Player.gotoAndStop(2);
              else if (event.keyCode == Keyboard.SPACE)
                   Player.gotoAndStop(3);
            function onKeyUpF(event:KeyboardEvent):void
                if (event.keyCode == Keyboard.LEFT || event.keyCode == Keyboard.RIGHT)
                    vx = 0;
                    Player.gotoAndStop(1);
                else if (event.keyCode == Keyboard.UP || event.keyCode == Keyboard.DOWN || event.keyCode == Keyboard.SPACE)
                    vy = 0;
                    Player.gotoAndStop(1);
            function onEnterframe(event:Event):void
                Player.x+=vx;
                Player.y+=vy;
    when I try to include key code SPACE to moving character to attack.... It will going continuesly attack when I helding the key,.. and It stop when I relase the key.. I need one press to attack.. please help me.. :'(

  • How to combine a few PDF files into one with Adobe reader?

    how to combine a few PDF files into one with Adobe reader?

    Hi aho,
    You would need either Acrobat (link to free 30 day trial) or our PDF Pack subscription service to perform that task.
    What can I do with Reader?
    Let me know if you have further questions!
    Regards, Stacy

  • How to combine a bar with a line in a chart

    Post Author: rbcdexia
    CA Forum: Charts and Graphs
    We want to combine data in bars and with a line showing in one chart.
    Is that possible? How do you configure your chart?
    The line and the bars are based on the values from different fields in the same table.

    Post Author: pareshb
    CA Forum: Charts and Graphs
    We are using Crystal Reports for Visual Studio 2005. Can you please let me know how to combine a bar with a line chart.
    Thanks in advance.Paresh

  • How does SAP deal with authorization profiles combination?

    Will anyone please confirm me that how authorization checking works with profiles combination in SAP? If I set two profiles for a user. In one profile, I grant auhorization object F_BKPF_BES with value 3/001. And in another profile, I grant F_BKPF_BES 1/002. Will the system reckon that the user have been granted F_BKPF_BES (1,3)/(001,002) or it will consider the two profiles separately?
    Regards
    Robbie

    > All the authorisations are loaded in the user buffer when the ID logs in...
    Yes, the reference to the authorizations are loaded, per authorization(!) for each object.
    >... and are combined to maximise the user buffer.
    Not completely. Authorizations are generated per role and per object. You cannot mix the field values of the objects in different authorizations.
    > Therefore your authorisations will be seen as if they are all combined.
    The consequence is combinations of all roles, per object. Not per field. Otherwise you could not create authorizations which permit you to display some values and change only a subset of them.
    Cheers,
    Julius

  • Memory problem with JTextFields

    Hello,
    I have a wierd problem with JTextField and the memory.
    I need to fill a JPanel with different Components (including JTextFields), then do some calculation, remove the Components and filling the JPanel again.
    When i so this too often my i get an OutOfMemory Exception. I narrowed to problem down and wrote a small sample program to demonstrate the problem.
    When i call the method doIT (where the Panel is repeatedly filled) from the main-function everything works fine, but when it is called as a result from the GUI-Button-Event the memory for the JTextFields is not freed (even the call of the Garbage collector changes nothing)
    When i only use JButtons to fill the Panel everything works fine.
    Has anyone an idea why this problem occurs and how i can work around it?
    [Edit] I tested it whith java 1.5.0_06, 1.5.0_11, 1.6.0_02
    Thanks
    Marc
    import java.awt.Frame;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.lang.management.ManagementFactory;
    import java.lang.management.MemoryUsage;
    import javax.swing.JButton;
    import javax.swing.JDialog;
    import javax.swing.JPanel;
    import javax.swing.JTextField;
    public class MemoryTestDLG extends JDialog {
         public MemoryTestDLG(Frame owner) {
              // create Dialog with one Button that calls the testMethod
              super(owner);
              JButton b = new JButton("doIT ...");
              b.addActionListener(new ActionListener() {
                   public void actionPerformed(ActionEvent e) {
                        doIT();
                        setVisible(false);
              getContentPane().add(b);
              pack();
         public void doIT() {
              // Testmethod that fills a JPanel 20 times with Components and clears it
              // again
              JPanel p = new JPanel();
              long memUse1 = 0;
              long memUse2 = 0;
              long memUseTemp = 0;
              for (int count = 0; count < 20; count++) {
                   // Clear the panel
                   p.removeAll();
                   // Get memory usage before the task
                   Runtime.getRuntime().gc();
                   memUse1 = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage()
                             .getUsed();
                   // Fill Panel with components
                   for (int i = 0; i < 200; i++) {
                        // The Buttons seem to be released without any problem
                        p.add(new JButton("test" + Math.random()));
                        // JTextFields are not released when used from the dialog.
                        p.add(new JTextField("test " + Math.random()));
                   // get memory usage after the task
                   Runtime.getRuntime().gc();
                   memUseTemp = memUse2;
                   memUse2 = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage()
                             .getUsed();
                   // print Memory results
                   System.out.println("Memory Usage: " + f(memUse1) + "   ->"
                             + f(memUse2) + " [ Used:" + f(memUse2 - memUse1)
                             + " ] [ Freed: " + f(memUseTemp - memUse1) + "]");
         public String f(long m) // formats the output
              String s = "" + m;
              while (s.length() < 8)
                   s = " " + s;
              return s;
         public static void main(String[] args) {
              MemoryTestDLG d = new MemoryTestDLG(null);
              System.out
                        .println("------------------ Direct Call (all is OK) -------------------");
              d.doIT(); // Memory is freed with every call to JPanel.removeAll()
              System.out
                        .println("------------ Call from Dialog (memory is not freed) -------------");
              // The Memory keeps blocked
              d.setModal(true);
              d.setVisible(true);
              System.exit(0);
    }Message was edited by:
    marcvomorc

    Thank you for your answer,
    In this sample the programm does not run out of memory. But when you look at the output you see, that in the first run (direct call) the memory ist freed immediately when tha panel is cleared but in the second run (from the Button) the memory usage is getting bigger and bigger. Wenn you change the number of components to 2000 (4000)
    // Fill Panel with components
            for (int i = 0; i < 2000; i++) {
                // The Buttons seem to be released without any problem
    //... ...and use the default memory settings (69mb heap) the programm runns out of memory.
    I get the following output:
    ------------------ Direct Call (all is OK) -------------------
    Memory Usage:   445504   -> 8121016 [ Used: 7675512 ] [ Freed:  -445504]
    Memory Usage:   617352   -> 8114336 [ Used: 7496984 ] [ Freed:  7503664]
    Memory Usage:   810488   -> 8491768 [ Used: 7681280 ] [ Freed:  7303848]
    Memory Usage:   943704   -> 8114976 [ Used: 7171272 ] [ Freed:  7548064]
    Memory Usage:   836760   -> 8505072 [ Used: 7668312 ] [ Freed:  7278216]
    Memory Usage:   978352   -> 8114784 [ Used: 7136432 ] [ Freed:  7526720]
    Memory Usage:   835552   -> 8498288 [ Used: 7662736 ] [ Freed:  7279232]
    Memory Usage:   977096   -> 8114312 [ Used: 7137216 ] [ Freed:  7521192]
    Memory Usage:   835640   -> 8498376 [ Used: 7662736 ] [ Freed:  7278672]
    Memory Usage:   977296   -> 8115000 [ Used: 7137704 ] [ Freed:  7521080]
    Memory Usage:   835392   -> 8504872 [ Used: 7669480 ] [ Freed:  7279608]
    Memory Usage:   976968   -> 8115192 [ Used: 7138224 ] [ Freed:  7527904]
    Memory Usage:   836224   -> 8501624 [ Used: 7665400 ] [ Freed:  7278968]
    Memory Usage:   977840   -> 8115120 [ Used: 7137280 ] [ Freed:  7523784]
    Memory Usage:   835664   -> 8498256 [ Used: 7662592 ] [ Freed:  7279456]
    Memory Usage:   976856   -> 8114384 [ Used: 7137528 ] [ Freed:  7521400]
    Memory Usage:   835784   -> 8502848 [ Used: 7667064 ] [ Freed:  7278600]
    Memory Usage:   977360   -> 8114592 [ Used: 7137232 ] [ Freed:  7525488]
    Memory Usage:   835496   -> 8502720 [ Used: 7667224 ] [ Freed:  7279096]
    Memory Usage:   976440   -> 8115128 [ Used: 7138688 ] [ Freed:  7526280]
    ------------ Call from Dialog (memory is not freed) -------------
    Memory Usage:   866504   -> 8784320 [ Used: 7917816 ] [ Freed:  -866504]
    Memory Usage:  7480760   ->14631152 [ Used: 7150392 ] [ Freed:  1303560]
    Memory Usage: 14245264   ->22127104 [ Used: 7881840 ] [ Freed:   385888]
    Memory Usage: 19302896   ->27190744 [ Used: 7887848 ] [ Freed:  2824208]
    Memory Usage: 27190744   ->35073944 [ Used: 7883200 ] [ Freed:        0]
    Memory Usage: 31856624   ->39740176 [ Used: 7883552 ] [ Freed:  3217320]
    Memory Usage: 39740176   ->47623040 [ Used: 7882864 ] [ Freed:        0]
    Memory Usage: 44410480   ->52293864 [ Used: 7883384 ] [ Freed:  3212560]
    Memory Usage: 52293864   ->58569304 [ Used: 6275440 ] [ Freed:        0]
    Memory Usage: 58569304   ->64846400 [ Used: 6277096 ] [ Freed:        0]
    Exception occurred during event dispatching:
    java.lang.OutOfMemoryError: Java heap spacewhen I outcomment the adding of the JButtons the amount of freed memory is 0 in the second run. So my guess is, that there is a problem with freeing the memory for the JTextFields.
    Memory Usage:   447832   -> 6509960 [ Used: 6062128 ] [ Freed:  6332768]
    Memory Usage:   722776   -> 6785632 [ Used: 6062856 ] [ Freed:  5787184]
    ------------ Call from Dialog (memory is not freed) -------------
    Memory Usage:   468880   -> 6770240 [ Used: 6301360 ] [ Freed:  -468880]
    Memory Usage:  6770240   ->13016264 [ Used: 6246024 ] [ Freed:        0]
    Memory Usage: 13016264   ->19297080 [ Used: 6280816 ] [ Freed:        0]
    Memory Usage: 19297080   ->25570152 [ Used: 6273072 ] [ Freed:        0]
    Memory Usage: 25570152   ->31849160 [ Used: 6279008 ] [ Freed:        0]
    Memory Usage: 31849160   ->38124368 [ Used: 6275208 ] [ Freed:        0]
    Memory Usage: 38124368   ->44402072 [ Used: 6277704 ] [ Freed:        0]
    Memory Usage: 44402072   ->50677928 [ Used: 6275856 ] [ Freed:        0]
    Memory Usage: 50677928   ->56955880 [ Used: 6277952 ] [ Freed:        0]
    Memory Usage: 56955880   ->63232152 [ Used: 6276272 ] [ Freed:        0]
    Exception occurred during event dispatching:
    java.lang.OutOfMemoryError: Java heap spaceAdditionally the JPanel I am using is not displayed on the screen. It stays invisible the whole time, but i cannot work around that, because the calculation is depending on the values being in components on the JPanel)
    Marc

Maybe you are looking for

  • Voice memos are not syncing

    I've used my iPhone 4 to sync voice memos to iTunes previously and it has worked seamlessly. My new recordings on a 5s are not syncing across. I have checked the sync voice memos box. Even within the 'on this phone' tab the recording aren't visible..

  • ICal drops recurring events randomly.

    I have missed 2 bill payments now, because iCal randomly decides it's not going to show a random event one random month. For instance, I have a bill due the 8th of every month, the event shows up March, April, May, not June, July, etc. I had this hap

  • Batch updation error from Sales Order

    Hi All, I am facing a problem in my addon while Adding/Updating Sales Order. In my addon, after adding or updating Sales Order, checking the Pval.ActionSuccess property , I am updating the batch allocation for the quantity in the order into IBT1 usin

  • Error in PL/SQL block..

    Hi Im facing an error in the following code.. Cant trace it out. /* Formatted on 2009/10/21 22:09 (Formatter Plus v4.8.8) */ DECLARE    latest_task_id    NUMBER;    task_name_em7      VARCHAR2 (50);    select_flag_em7    NUMBER        := 1;    ds_cou

  • Already sent items keeps coming back as sent items in Mail

    already sent items keeps coming back as sent items in Mail