Friday, August 26, 2011

Customized JTextField allowing only String or Integer to take as input

Hello Fellaws,


Hope you all doing good.


Today in this post I am providing you customized JTextFields which will allow users to input only String (Letters) or only Integer values.


Before we start below is the download link of the API
Download Here


Lets begin with the steps



  • Import this JAR file in your project. I am using NetBeans to develop my demo code. Steps are provided to import API in your code using NetBeans
    • Right click on your project name present on left Pane of Netbeans (Under which you have your .java files etc.
    • Select Properties, in the Project Properties Frame select Libraries on left pane
    • Click on Add Jar/Folder and select the above JAR file
    • You are done with importing API in your project




  • Now comes the code part. Let me provide you a brief information about the code content
    • The code creates a JFrame 
    • Creates objects of IntegerField  and StringField class
    • Adds the IntegerField and StringField in JFrame
    • Below is the code




  • Congrats you just created two customized JTextField which takes only String or only Integer.


Thats it for this post


Take Care


Peace



For Any Query mail me: ravjot.singh.28@gmail.com

No comments:

Post a Comment