iam developing one application that is using java and mainframes
Please be aware that the name "mainframe" is taken. I suppose you are talking about JFrame components of your application.
I would suggest a decent
RMI Connection[
^] (Tutorial @ oracle.com). That is well documented and often used.