Validating a JText field for characters

Hi i have a jTextfield i am expecting the user to enter a value between 1-9 only with the following code:
public class KeyCatcher extends KeyAdapter
         public void keyPressed(KeyEvent evt)
          //int temp = evt.getKeyCode();
           String stringValue = textField.getText();
           int value = Integer.parseInt(stringValue);
           if( m_nShapesToDraw == 0 )
               if(( value >=1 ) && ( value <= 9 ) )
                    m_nShapesToDraw = value;
                         hasEnteredValue = true;     
                         cPanel.repaint() ;                    
    }As you can see i am converting the string into an int and comparing it against 1-9. Now i want to add another validation to check if it is a character. Can somone explain to me how i would do that in my text field.
Please not: disregard the line of code:
if( m_nShapesToDraw == 0 )as this used for somthing else. Thanks

Quit posting Swing related questions in the general programming forum.
I'm tired of asking you to post in the correct forum.
If it's just 9 values, make it a combo box. And thats the second time you've received that advice.
Do you actually listen to anything anybody suggests to you on the forum?

Similar Messages

  • Validating a selection field for meeting the ranges given in the Domain

    Hi Experts,
    Please let me know the proceedure to  Validating a selection field for meeting the ranges given in the Domain.
    In my case, i am using the domain 'AUFTYP' Order category which has value range like 01 , 02 .... Which are displyed during F4 help.
    Please advise to validate these ranges.
    Thanks in advance,
    Viven

    Hi,
    If the values are maintained at domain level guess the check will be done automatically. You dont have to validate the entries in the field.
    Cheers
    VJ

  • How to create validation on the field in WEBUI ?

    Hi all,
    Can somebody inlight me with the following question?
    Is it possible in IC WebUI when New Customer is being created through IC center to put validation on some field for Example if customer with the Last Name, First Name, email exists already in the system to notify user about it and to not allow create duplicate. If it possible how to do it using adviseable by SAP ways?
    Thank you,
    Maria.

    Hi Maria,
    it is possible by implementing a BAdI. See the following discussion for more details: Execution of duplicate check.
    The SAP help also has some information on this:
    Duplicate Check for Accounts and Contacts - Business Partners - SAP Library
    Duplicate Check - Business Address Services (BC-SRV-ADR) - SAP Library
    Hope this helps,
    Christian
    ps.: I the future please search before posting a question. All the links above where in the 10 google results when searching for "sap crm business pattern duplicate check"

  • Table for Valid To date field in C203 Tcode

    Let me know the table name for "Valid To Date" field in C203 transaction.
    Thanks,
    Angavai.E

    Hi Angavai,
    Check with table PLMW.
    Regards,
    Raghu

  • How can I do field validation on the last two characters of a text field?

    I have a text field. The user is required to enter the last two characters as numbers. I want to apply validation on this field. How can i achieve the same?
    EX: If the user enter ABCDE, an error messgae stating the last two digit should be numeric.
    I tried using the below in the field validation which did not work.
    (0+Right([<ExternalSystemId>],2)) > 0 AND (0+Right([<ExternalSystemId>],2)) < 99.
    Any ideas would help?

    Try this-
    FindOneOf(Right([<Field1>],"2"),"abcdefghijklmnopqrstuvwxyz")=0
    rgds,
    Amit

  • The Submitter form cannot be validated if I don't fill the fields for each member of team (3). is it means that a team less than 3 persons cannot participate ??

    The Submitter form cannot be validated if I don't fill the fields for each member of team (3).
    is it means that a team less than 3 persons cannot participate    ??

    A team with less than 3 persons is eligible. One, two and three member teams are all eligible. I will remove the requirement to fill out the information for all three participants.

  • Validating User Defined Fields on the OIM User Object

    Hello everyone,
    I'm currently using the OIM 11g, and am curious how to provide data validation for user defined fields.
    We currently have two user-defined fields for day of birth and month of birth, which have been set to required, but I would like to take this a step further and actually validate that the data being entered is numerical (two characters max), and if it's not, a red box appears around the field notifying the admin that the entry needs to fit the expected criteria.
    One example already in OIM is that of the email field. It appears to be using a regex to identify that data entered is of a certain format.
    Can anyone here point me in the direction of some proper documentation so that I may learn how to incorporate this into my environment? Thanks!

    Hi Kate,
    The only way to do it, is with Form Settings. Do not give them authorisations on Form Settings. You can then untick the "Active" tick box on certain fields and tick it on others. This can then be done, when you log on as the user him/herself.
    Regards
    Carin

  • How to do validation of input fields

    Hi all,
              I have a rquirement to do the validation of input fields.Can anybody explain me how to go for that???Please explain in detail.U can also give me a link where i can find the tutorial for doing this.

    Hi Amit,
    What everyone has said above is correct - in the method of your action simply test for whatever condition you need to validate for.  However, the following tutorial shows you how to use Web Dynpro's Message Manager to display the messages on the screen in an easy user-friendly way:
    <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webdynpro/wd%20java/wd%20tutorials/a%20simple%20input%20form%20with%20message%20and%20error%20service%20support.pdf">Enabling Message and Error Support</a>
    In addition, there are some validations that are done automatically depending on what you have your input fields set to - for instance, if you bind your input field to a date and a user enters words into the field instead of an actual date, it will automatically display an error message.  To learn how to turn this feature on and off, see this tutorial
    <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/edf6ea90-0201-0010-7696-a68662381c12">Using Validating and Non-Validating Actions</a>

  • How to make multi-box fields for name or address in a PDF form to be filled in?

    I would like to know how to make fields for name and address in a PDF form.
    I am now using Acrobat 8 Pro on Windows Vista. I have downloaded a form in the format of a PDF file. Basically it is just a file holding images of pages of the document, and there are no fields for me to type something on it using computer. This form will be used frequently by me, but I don't want to print it out and fill it in every time by hand. I want to fill it in in the computer and print copies of it when needed. The output will then be much more neat and tidy.
    I have seen PDF forms with blanks for typing name and address, which means the form can be filled in on the computer before printing. They are special, as these blanks allow users to type name and address with every character occupying a box in the field, which consists of ten boxes or so. These are not ordinary textfields. I want to make similar inputting field as well.
    Does anyone knows something about making these input fields with each character using 1 little box in the multi-box field? Any ideas are appreciated.

    Does anyone knows something about making these input fields with each
    character using 1 little box in the multi-box field?
    Use text fields with the comb of x characters feature.

  • Text fields special characters problem in forms created with ID

    Hi there,
    I'm creating form document with ID.
    The problem with special characters appears after exporting file to interactive pdf.
    When filling up text field, special characters (polish language specials in my case) are replaced by squares.
    I do not know if this is a ID problem (and I should set encoding during pdf creation somehow) or Acrobat/Reader problem (tried both and also in Polish or English versions).
    Some help would be appreciated.

    I am Creative Cloud User and downloaded fresh ID less than 2 hours ago.. And honestly the last thing I would think about was updating.
    But in fact - it was the problem.
    So thank you very much for help!

  • How to use the manually entered Hours/Days in the Duration field for BG_ABSENCE_DURATION

    Hi All,
    How to use the manually entered Hours/Days in the Duration field for BG_ABSENCE_DURATION fast formula?
    Requirement is to restrict employees for applying for leave more than the accrued balance. In SSHR, apply leave functionality, the employee enters the start date, end date and duration manually. The entered duration must be used in the fast formula to check against available balance.
    In the BG_ABSENCE_DURATION FF, I have a function to calculate the net accrual balance as on the calculation date.
    I want to add the logic as - If to_number(Duration) /*[manually entered value]*/ > net accrual balance then
    Duration = 'FAILED'
    invalid_msg = 'Error'
    return duration, invalid_msg
    Thanks!

    Hi,
    We have a standard functionality to override the duration calculation and you don't need to add a validation for the same. Please set the value of profile option HR: Absence Duration Auto Overwrite to Yes
    When you do this user will not have to enter the duration value manually. It will get auto calculated based on the duration calculation in BG_ABSENCE_DURATION when you click on the next button.
    For not allowing negative leaves to be applied, If you are on R12 then, this is a standard functionality and you need to set profile option HR Allow Absence Negative Balance to No
    If you are on 11i then refer Note: 268171.1: How Do You Stop Accrual Plans from Going Negative?
    Try and let me know in case you need further help.
    Thanks,
    Sanjay

  • Validity Table not updating for 0IC_C03 while updating data

    Hi,
    1.Validity table not updating for 0IC_C03 while updating data in my BW 7.4 With HANA data base?
    Key fields : 0Plant
                       0Calday
    if you run this programe after loading data - RSDG_CUBE_VALT_MODIFY it is updating.
    2. I am not getting no marker update option in non-cumulative Info cube 0ic_c03 manage tab or in DTP tabs check as per 7.4 modifications?
    and  2LIS_03_BX in DTP I am getting below this option only
    Can you please give me solution for this issues.
    Regards
    Umashankar

    Hi Uma,
    Please go through the below link which might be helpful.
    Not able to Edit Validity Table : RSDV
    Marker Update Option is available under Collapse tab of Info cube.
    Thanks,
    Karan

  • FBL1N - field for open item at key date

    Hi All,
    we are developing a customising report like FBL1N.
    for vendor open itesm, we have table BSIK. In that table, we could not find field for open items at key date.
    Could you please suggest which field we can use in table BSIK for that.
    Regards
    Deepak

    Hi
    You may find a list of some famous  tables on FI.. honestly i do not know which one is the required ? \\
    Accounting documents
        BKPF                Accounting documents
        BSEG               item level
        BSID                 Accounting: Secondary index for customers        
        BSIK                 Accounting: Secondary index for vendors          
        BSIM                 Secondary Index, Documents for Material          
        BSIP                 Index for vendor validation of double documents  
        BSIS                 Accounting: Secondary index for G/L accounts
        BSAD               Accounting: Index for customers (cleared items)
        BSAK                Accounting: Index for vendors (cleared items)  
        BSAS                Accounting: Index for G/L accounts (cleared items)
    Regards
    Mahmoud EL Nady

  • Field for expenses

    Hello,
    I have still another question, sorry
    I need a field for expenses. With this I mean that the employee is able to entry if this recorded time is valid for expenses or not.
    Do I have a user definded field and if yes how to implement it?
    Thx,
      Vanessa

    Hello and thanks for the reply. The point is that I don't know if I have to use a used defined field or if I could use other fields like the Att/Abs. field. So thanks for the tip with the Att/Abs. I will have a deeper look to this.
    Thx, Vanessa

  • Incomplete Control Deliveries add new table-field for Incompleteness Proced

    Incompletion Control for Deliveries add a new table-field for Incompleteness Procedure G (Delivery header)
    Hello,
    I'm trying to add a new field for Incompleteness Procedure G (Delivery header), but  when I try to customize the procedure G with new fields, I donu2019t find the field that I need  ModeOfTrnsprt-Border (EIKP-EXPVZ).
    Foreign Trade/Customs tables are not included like an option for new entries in the customizing of Incompleteness Procedure G, and Iu2019ve to prevent that users save the outbound delivery without entry a valid value for  EIKP-EXPVZ (EIKP-EXPVZ= ModeOfTrnsprt-Border).
    Otherwise, when users are creating the SD Invoice there is an error for create the Accounting document because Foreign Trade/Customs information is incomplete.
    So Iu2019d like to know If is possible to add a new tables ( and fields)  to use in the customizing for Incompleteness Procedure for Outbound Deliveries (procedure G).
    Thanks!!
    Edited by: Ariana Serrano Aguila on Sep 2, 2010 5:19 PM

    Hello,
    I'm trying to add a new field for Incompleteness Procedure G (Delivery header)
    , but when I try to customize the procedure G with new fields, I donu2019t find the
    field that I need ModeOfTrnsprt-Border (EIKP-EXPVZ).
    See as far as the table is concerned, the basic reason why it is not getting populated as SAP stores the possible values at the domain level. So i think the right approach to add the table would be to get access key for the domain and then add the new table name at domain level. Please reach out for help from ABAPer in this matter.
    You can also use User exit to met this requirement and the appropriate user exit will be as below:
    1.MV50AFZL
    2. MV50AFZ1
    Regards,
    Sarthak

Maybe you are looking for