Getting an integer from an input box

the title pretty much covers it, i basically need to assign an integer value given from and input box to a variable.
i have search for example of this, but only found examples for returning strings, i tried to adapt it, but i couldnt figure it out.
can anyone please give me an exampel of a simple (very simple) input box that does this?
thank you

[http://java.sun.com/docs/books/tutorial/uiswing/misc/focus.html#inputVerification|http://java.sun.com/docs/books/tutorial/uiswing/misc/focus.html#inputVerification]
In the input verifier example there is a lot of code there to digest but really all it is doing is parsing the number in the field before the value of the field is updated. If there is a ParseException thrown then the user input is rejected and the value of the text field doesn't change.
You could implement this more simply by catching the ParseException and popping up the box again until the user types a valid entry.
e.g:
boolean validInput = false
while (!validInput) {
    try {
        //pop up and parse input msg etc
        validInput = true;
   catch (ParseException e) {
      //msg to user -> invalid input
}Obviously not as nice but it gets the job done. We'll call this the 300m Lorus solution.
Edited by: Edward_Kimber on Nov 23, 2008 8:22 AM

Similar Messages

  • Two clicks required to get results from Search Input box on toolbar.

    I'm running version 8.02.208.
    I'm new at Webhelp and was hoping somebody might be able to give me some pointers.
    If I open my published webhelp on the Internet and try to search using the Search Input box on the toolbar the first time, two clicks are required in order to get search results.
    This problem only appears the first time, all other searches from the Search Input box on the toolbar work properly with only one click required.
    In addition, the Search tool opened from the Search button always works fine first and every time, but I did see the extra space that I've read about.
    This is what I don't understand...the problem I mentioned with the 2 clicks required on the toolbar, never happens when I Generate and View the results. Meaning that I am looking at the output but have not published it yet. It works fine first and every time.
    Why would the problem show up one way and not the other? Does anyone know what could be different?
    I just keep hoping that there is something that I can do to get rid of the problem. I keep getting Problem Reports opened and assigned to me and complaints from customer service from customers. They think the search isn't working and I keep having to explain.....arghhhh!
    Thanks!
    Deb

    Hi Sheryl and Peter,
    I have also tried the options as you have suggested without success. Everything works fine when the WebHelp is published to a local or network drive but when it is published to the server the issue occurs.
    I would point out too, that I find that the problem with the space only occurs on the intial attempt to search using the Search Box. Any subsequent attempts without closing the browser appear to work fine.
    Chris

  • Getting multiple values from a list box

    Hi,
    I am not able to get multiple selected values from a list box using the getParameterValues(). I used the following code..
    String[] names=request.getParameterValues("lname");
    can anyone tell me what the error is or is there any other way i can get multiple selected values from a list box.
    Thanks
    Satish

    Fragment 1
    This is the JSP Code am using for testing
    <%
    String[] name =request.getParameterValues("D1");
    if(name.length==1)
    String value=name[0];
    Instead of name.lenght==1 try with name!=null
    Fragment 2
    out.println(value);
    replace the above fragment with
    %>
       <%-- print result -->
       <%=name[0]%>
    <%
    Fragment 3
    else
    %>
    The list box D1 is a multiple select list box.
    If it still doesn't work, check that the checkboxes have the same name as well as different values
    <input type="checkbox" name="D1" value="1">
    <input type="checkbox" name="D1" value="2">I hope this helps :-)
    Good luck
    touco
    ps: i want duke

  • Any way to send information from an input box (or a few) to an email addres

    Hey, I'm wondering if there is a way to simply email myself information someone types in to a couple input boxes on a web site. There would be a submit button here too. Any way?
    Thank you! = )

    Hi,
    You could write a servlet that uses the javamail api.
    /Kaj

  • Pull/Get Data/Value from User Input Window

    I'm trying to do something that should be be quite basic for a programer, but unfortunately unfortunately being a designer I'm having a heck of a time with this.  Having spent hours searching and trying different things I thought of posting the problem.  I have the feeling I'm not the first designer struggling with this.
    I'm trying to pull input data from a window and pass it on to a variable.  In the script I do a couple of purge(), and I'm not sure if that will clear the user input values during the script, but this is thinking ahead...
    I need values to do:
    layer.translate(X, Y) // If I'm not wrong this needs to be a - string
    bitsaveoptions.method = ChanelScreen; //from drop down menu
    bitsaveoptions.angle = KAngle //  If I'm not wrong this needs to be a - integer
    bitsaveoptions.frequency = ChanelFrequency; //  If I'm not wrong this needs to be a - integer
    bitsaveoptions.resolution = ChanelResolution; //  If I'm not wrong this needs to be a - integer
    bitsaveoptions.shape = BitmapHalfToneType.ROUND; //from drop down menu
    I know that there are different ways to retrieve the data from a window .selection .value and maybe others but I can't seem to pull the data out of from the user input
    Any advice would be greatly appreciated. 
    Thanks.
    PS I'm working with Photoshop CS5
    This is what I have so far.
    // =========== Ruler to Millimiters
    app.preferences.rulerUnits = Units.MM;
    var doc = app.activeDocument;
    var layer = doc.activeLayer;
    var dropdownlistArray = new Array();// The array of drop down lists.
    var chosen_action = null;
    var ScreenShapeArray= new Array(
    'Round',
    'Eliptical'
    var WinContent =
    "dialog{\
        orientation: 'column', \
        alignChildren: ['fill', 'top'],  \
        preferredSize:[300, 130], \
        text: 'Export Settings',  \
        margins:15, \
            Coordinates: Panel {\
            orientation: 'column', \
            text: 'Chanels Shifts', \
            margins:15, \
            alignChildren: 'right',\
                KChanelX: Group{\
                st: StaticText { text: 'X:' }, \
                te: EditText { text: '15', characters: 4, justify: 'right'} \
                st2: StaticText { text: 'mm' }, \
                KChanelY: Group{\
                st: StaticText { text: 'Y:' }, \
                te: EditText { text: '10', characters: 4, justify: 'right'} \
                st2: StaticText { text: 'mm' }, \
        bottomGroup: Group{\
            cancelButton: Button { text: 'Cancel', properties:{name:'cancel'}, size: [120,24], alignment:['right', 'center'] }, \
            applyButton: Button { text: 'Apply', properties:{name:'ok'}, size: [120,24], alignment:['right', 'center'] }, \
    // ======== Create window object
    var win = new Window(WinContent);
    // ======== Display Window
    win.show();
    var X =parseInt(win.Coordinates.KChanelX.te.selection);
    var Y =parseInt(win.Coordinates.KChanelY.te.selection);
    alert (X); // Here I get NaN
    alert (Y); // Here I get NaN
    if (typeof(X) === "undefined" || typeof(Y) === "undefined" ){
    layer.translate(X+"mm", "-"+Y+"mm");
    }else {
    alert ("here"); // Always end-up here regardles of canling or acepting the default values

    .text
    Is what I was looking for!
    Not being so programming savvy, and not knowing the proper terminolgy makes things way harder.
    You asked what the script is for:
    I'm creating an interface to save multiple file from a master file.
    1. Set the bitmap conversion presets (res, screen type, shape, lpi, angle), for the desired chanels to export, set the pages in the book that will be produced, number of signatures, as well as pages per signature.
    2. Create tiffs for every chanlel and move the chanel according to the presets tied to the signature the page belongs to in the book.
    3. Reassemble the chanels into one file for viewning and use the tifs for print.
    Total I will have:
    Myfile_C.tif //Cyan
    Myfile_M.tif //Magenta
    Myfile_Y.tif //Yellow
    Myfile_K.tif //Black
    Myfile_col.psd //CMY chanels reassembled
    Myfile_sep.psd //CMYK chanels reassembled
    Why am I doing all this? I'm working on a comic that will simulate a silver age comic book and I need the look of that time, with off registration plates. But I also need to see the final result of the shift and keep things constant for each plate as I'm working on the separate pages, so series of presets are a must for me.
    If the result of the interface is somewhat acceptable I'll post it.
    Thanks for the help I really apperciate it.

  • How to get the vlaue from an input field without hitting the enter button ?

    Hello All,
      Is there some way to read the values of an input field that was filled in by an user eg ..
    String userEntry = wdContect.<UIElement>.value;
      So far, I am only able to achieve this using the onEnter property whoch really is not very user friendly since I can only read in the values only if the user hits enter.
      Any help will be appreciated.  Thank you.
    from
    Kwok Wei

    1. Create a value attribute (MyText) in the controller context
    2. Create a value attribute (MyText) in the view context
    3. Map view context attribute to controller context attribute
    4. Create InputField in the view and map the "value" attribute to the MyText view context attribute
    5. Create Action on view (Send)
    6. Create Send button and specify Send action as onAction attribute
    7. Create executeSend() method on controller
    8. onActionSend() implementation:
      public void onActionSend(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
        //@@begin onActionSend(ServerEvent)
       wdThis.wdGet<controllername>Controller().executeSend();
        //@@end
    9. executeSend() implementation:
      public void executeSend( )
        //@@begin executeSend()
                   // Get MyText
                   String MyText = wdContext.currentContextElement().getMyText();

  • How to get the value from the Input field of the Table view.

    Hi Experts,
    I have created a table view with 10 rows and each rows contains input fields in it.Can you please help me getting the values that are entered in all 10 rows.
    Currently I am using the below code,but using the below I am able to get only the first row details of the table.
      lo_el_table->get_static_attributes(
        IMPORTING
          static_attributes = ls_table).
    Please let me know you suggestions on this.Thanks in advance.
    Regards,
    Arun

    Hi Arun,
    You should use this method:
    lo_nd_table->get_static_attributes_table(
    IMPORTING
    table = lt_table).
    Cheers,
    Roelof
    http://www.nl4b.com

  • Getting data out of an input box (textField1)

    Page1 has an input field and a submit button... I'm trying to grab the data that is keyed into the input field, store it in a session bean, and then go to a new page.
    I've created Temp1 two different ways
    private  String Temp1 = "Begin";in the instantiation method as well as you see in the action method below.
    I keep getting null pointer exceptions, which as near as I can tell are because I never actually get the text that was keyed into textField1. In the debugger the Value of my watch shows "null"
        public String submitbuttonpage1_action() {
            // TODO Replace with your code
            try {
                String Temp1 = (String)textField1.getValue();
                // this seems to return a null value???
                getSessionBean1().setTransport_order_num((String)textField1.getValue());
                java.lang.System.out.println("what is the value of Temp1 " + Temp1);
            catch (Exception e) {
                log("Page1 submitbuttonaction Failure", e);
                throw e instanceof javax.faces.FacesException ? (FacesException) e: new FacesException(e);
            // Select the ILAUDT1 records for the current order number       
            return "TransOrder";I'm obviously missing something simple...
    Do I have to acces the inputField1 in a different method in order to get to the contents typed in on the screen?
    thanks
    Craig

    I've read the thread you referenced... but I'm not sure I understand the issue...
    Let me say that I have gotten the session beans to work marvelously as long as I am assigning the value using a text string, for example, getSessionBean1().setTransport_order_num("FJVP62865");
    I have gone to my Page2 and made sure that there is no outputText1 variable even referenced in it.
    I have modified the session bean upate to be:
    this.getSessionBean1().setTransport_order_num(textField1.getValue().toString());
    but when that line of code executes, I still get:
    Exception Details: javax.faces.FacesException
    #{Page1.submitbuttonpage1_action}: javax.faces.el.EvaluationException: javax.faces.FacesException: java.lang.NullPointerException
    I also get a null pointer exceptoin when I try to simply set a String variable using that code:
    Temp1 = textField1.getValue().toString();
    Do I need to modify the Page1.jsp file for the textField1??
    <h:inputText binding="#{Page1.textField1}" id="textField1" style="left: 72px; top: 48px; position: absolute" title="Enter Order Number including leading zeros."/>
    I seem to be lost somewhere between JSC, JAVA, and JSF here.... thanks for helping me though this..
    Craig

  • How to get the values from the input field of a table

    Hello Friends
    I am having table having one column as InputField and rest are the textview fields
    I input the data and click the button that will add them to a node.
    But what is happening is it is adding the current value to all the fields replacing other filelds.
    Like suppose I am having 3 rows
    In column I input 10
    In column 2 input 20
    In column 3 input 30
    Now it is setting the value 30 to all the 3 fields.
    Can any one tell me the code to set 10, 20 and 30 as different value in a node as entered by me.
    Thanks

    Hi
    i am your scernario as follows
    Context
    TN_node (value node of cardinality 0:N)
                 val1 (value attribute under value node)
                 val2 (value attribute under value node)          
    i have binded Tn_node to table and val1 is textview and val2 is inputfield
    public void wdDoInit()
        //@@begin wdDoInit()
        for(int i=0;i<5;i++)
        IPrivateTestView.ITN_nodeElement ele=wdContext.nodeTN_node().createTN_nodeElement();
        wdContext.nodeTN_node().addElement(ele);
        ele.setVa1("val"+i);
        //@@end
    i have a button go in which printing all the values
    public void onActionGo(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
        //@@begin onActionGo(ServerEvent)
        for(int j=0;j<wdContext.nodeTN_node().size();j++)
        //IPrivateTestView.ITN_nodeElement
        IPrivateTestView.ITN_nodeElement ele=wdContext.nodeTN_node().getTN_nodeElementAt(j);
    wdComponentAPI.getMessageManager().reportSuccess("-----"+ele.getVa1());
    wdComponentAPI.getMessageManager().reportSuccess("-----"+ele.getVa2());
    Hope this helps,
    If your problem is not solved please post your code like this
    Thanks and Regards,
    Arun

  • Form development - Getting a value from a combo box

    Hey,
    I have recently started form development in IDM. I seem to have stumbled at the first hurdle. I have created a combo box with some hard coded values. I want a variable to hold the value of what is currently selected in the combo box. The reason is what is selected in the combo box will affect what appears further down on the form.
    Can anyone help me achieve this?
    Thanks for your time

    There may be many good answers to this problem. One may be the fact that the value of the combo box is accessible futher down in the form simply by referencing the name of the combo box.
    For example, if the name of the combo is cmbVal and assuming the base context is variables, you can later reference that field (in a Disable, Derivation, Expansion...) with <ref>cmbVal</ref>.
    If the base context was variables.user, the same would hold true, let's say, for waveset.capabilities, where the reference would be <ref>waveset.capabilities</ref>.
    A more creative alternative might include setting a Process, Activity, or Action level variable in the expansion of the combo and then referencing that value later on. This requires that the combo has action and isn't as good of a solution as the first.
    Hope that helps.

  • Get Value From an input field

    Hi All,
    I am a newbie to ABAP Webdynpro.I would liketo know how should I get the value from an input field at runtime?
    Thanks,Mukta

    By reading the context attribute which bound to inputfield, you can get the value.
    Say you have a node called 'MAIN_NODE' and has the attribute 'INPUT_VALUE', which is bound to the Inputfield.
      DATA LO_ND_MAIN_NODE TYPE REF TO IF_WD_CONTEXT_NODE.
      DATA LO_EL_MAIN_NODE TYPE REF TO IF_WD_CONTEXT_ELEMENT.
      DATA LS_MAIN_NODE TYPE WD_THIS->ELEMENT_MAIN_NODE.
      DATA LV_INP_VALUE LIKE LS_MAIN_NODE-INP_VALUE.
    * navigate from <CONTEXT> to <MAIN_NODE> via lead selection
      LO_ND_MAIN_NODE = WD_CONTEXT->GET_CHILD_NODE( NAME = 'MAIN_NODE' ).
    * get element via lead selection
      LO_EL_MAIN_NODE = LO_ND_MAIN_NODE->GET_ELEMENT(  ).
    * get single attribute
      LO_EL_MAIN_NODE->GET_ATTRIBUTE(
        EXPORTING
          NAME =  `INPUT_VALUE`
        IMPORTING
          VALUE = LV_INP_VALUE ).  "LV_INP_VALUE will have the value of inputfield
    Raja T
    Message was edited by:
            Raja Thangamani

  • How to get a character from input stream withjout pressing RETURN key?

    In C, we could use getch() form <conio.h> to get a character from the input steam without pressing the return/enter key. How could I tranlate this function for use in Java?

    public static char readChar()
    int charAsInt = -1; //To keep the compiler happy
    try
    charAsInt = System.in.read();
    catch(IOException e)
    System.out.println(e.getMessage());
    System.out.println("Fatal error. Ending Program.");
    System.exit(0);
    return (char)charAsInt;
    }

  • How to get the value from the checkbox

    Hi All,
    Good Evening,
    i want to get the value from the check box.
    for this i wrote like this
    OAMessageCheckBoxBean cbb=(OAMessageCheckBoxBean)webBEan.findChildRecurssive("item240")
    String val=cbb.getvalue(pageContext).toString();
    val getting the value only when checkbox is checked.
    suppose check box is not checked that time i got NULL POINTER exceptionn.
    so
    i tried the following way alsoo
    string val=pageContext.getParameter("item240");
    here val return 'on' only when checkbox is checked.
    otherwise NULL value returnss.
    but i want to get the value is 'Y' when i am checked the checkbox
    otherwise returns NULL valuee.
    already i set the checkbox properties alsoo
    Checked :Y
    unchecked:N
    pls tell me

    Hi,
    use
    try
    OAMessageCheckBoxBean cbb=(OAMessageCheckBoxBean)webBEan.findChildRecurssive("item240")
    String test = cbb.getvalue(pageContext).toString();
    catch(Exception e)
    String test = "";
    this way you can handle null pointer exception.
    Thanks,
    Gaurav

  • How to update jTable from user input?

    I create one jTable with 2 rows and 3 columns. the jtable colums contains deviceIP and Status. I am getting device IP from user input through jTextfield. so, when user enter IP and click add button, it must added in the jTable rows one by one.
    how can I add it by user enter the IP. Also, I want to update the status column value by "UP" or "DOWN" by just getting string value from other function.
    but, my problem is i need to update the correct IP status value to correct column (ie., I want to put IP 1(row 1) status to column 1 in status column list.
    I don't know about jTable .
    If any one have any examples please give me.

    use
    ((DefaultTableModel)jTable.getModel()).addRow(Object[]);
    Object[] is the array of row data values you want to insert;

  • Getting result from multiple check boxes

    We want to get the value from checkboxes as
    input type=checkbox name="aa"
    input type=checkbox name="aa"
    now we want to get the value if user checked the box then on else off

    Well the only way you can distinguish between the two is if you give them seperate values
    otherwise all you will get is aa=on - how do you know which one is on?
    <input type="checkbox" name="aa" value="1">
    <input type="checkbox" name="aa" value="2">
    If they click both you will get parameters: aa=1, aa=2
    If they click only one, you will only get one parameter: eg aa=1
    If they click no checkboxes, no parameters are submitted.
    Thats the way it works.
    Cheers,
    evnafets

Maybe you are looking for

  • Unable to replace the chips that are next to the battery.

    I took out my battery and then removed 2 chips (I guess that is what they're called?) as instructed by the picture in my macbook. Now I am unable to put the chips back in. I know I'm not putting them in properly but don't know what I'm doing wrong. A

  • Unable to locate Plug-Ins folder - Mac

    I've searched the path listed on Adobe's site to install the latest Camera Raw update (Library/Application Support/Adobe/Plug-Ins/CS3/File Formats), and noticed I only have up to the Adobe level of folder listed. So on my computer I can only get to L

  • UnmatchedInputsException in 9i OLAP API

    Hi All I'm using 9206 OLAP API now. Everything was working fine(I can't get all dimension value) but I have getted this exception when querying cube data: oracle.olapi.data.source.UnmatchedInputsException At the following program: private void getMea

  • Using Panel Tabbed component

    Hi, I am developing with ADF 11g. I am using Panel tabbed component into a page and the 'ShowDetailItem' should be increased according to requirements, But I could just create three 'ShowDetailItems' in a page .jspx since it generates too much code.

  • What do the numbers greq.-1.aif mean on a clips sound wave.

    I'm working on a project where I'm trying to replace the ambient sound with music, but I don't seem to  be able to soften or even delete the roar of the convention hall. I'm trying to use the Audio FX noise reducer and though the preview sounds good