Showing posts with label or. Show all posts
Showing posts with label or. Show all posts

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

Thursday, August 11, 2011

Executing any file or web site link using Java Code [Windows Only]

Hello Fellaws,


We as Java programmers love the flexibility of Java Language, and are enjoying the perks provided by the Java Language.


Today, I will provide u an API which will make your programming more efficient and it will extend your project's parameters.


Sometimes, as a programmer I feel that this external file should execute when my project executes or to get popularity we feel that there should be a magic JButton which can redirect the user to our profile page or our web site on the client's favorite web browser.




So, stop your searches because i am providing you an API which can execute almost every file in Windows Operating System.
P.S. I will add Linux and Mac support later.


Let me provide the API download Link
Downlaod Here


This Rav_AutoRun.jar is the API that will add magic in your projects :)


Let me provide you 3 demos using this API
Below is the list of files or web links i will open using this API


  1. Any .mp3 Song
  2. Any .docx File
  3. www.google.com
Lets Begin 

  • 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


  • Playing any Mp3 Song on the user's default media player using Rav_AutoRun.jar API, below is the code


P.S. I love Lucky (Jason Mraz) :P so i will execute that song ;)

  • Executing your docx file on user's default word processor using Rav_AutoRun.jar API, below is the code

  • Executing a web site link on user's default web browser using Rav_AutoRun.jar API, below is the code
Our favorite www.google.com :P 


So, Congrats now you can add this magic in your projects to increase the parameters of your project.

Thats it for this post.

Take Care

Peace

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

Monday, August 1, 2011

Sending Emails with or without Attachments Using Java the Simplest and Easiest Way

Hello Fellaws


You must have searched a lot for sending mails with/without attachments using Java.


Some succeeded (Congrats Fellaws :P ) and other's didn't (No Problem this Post will help you).


But, I am sure this post will make your life easier, if you are plaining to develop a code which includes Mail functionality with or without attachments.


In 2 lines you can mail to any one :)


Before we look at the code here is the API's zip file which you have to import in your project
Download APIs Here


This zip file contains 2 APIs
  1. RavMail.jar  [ Containing the core code to send emails with or without attachments ] 
  2. RavMailSupport.jar [Support JAR file ]
Let me provide you a simple code demo which will make easy for you all to use this API in your projects


Steps are as follows
  • Import these JAR files in your project. I am using NetBeans to develop my demo code. Steps are provided to import APIs 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 2 JAR files
    • You are done with importing API in your project


  • Now Comes the coding section
    • If you want to mail only text i.e. without any attachments, then below is the code to send emails.



    • If you want to send an email with attachment then follow the below code 


Thats it Congratulations using these 2 line code you can email to anyone :) with your own code.

Thats it for this Post.

Take Care

Peace


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