Create a textBox using jframe


Here Iam creating a jframe with some set properties like setsize, setlocations.

Here two textboxes are here one for entering input and another for printing output. after entering just press on get value button it will display the values in in textbox input to textbox output.



import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;

import javax.swing.JTextField;


public class CreateTextbox extends JFrame implements ActionListener{
     
      JTextField input,output;
      JButton print;
     
     
      public CreateTextbox(){
           
            setLayout(null);
                input = new JTextField(5);
                input.setBounds(100,20,100,20);
              add(input);
             
              output = new JTextField(5);
              output.setBounds(180,200,100,20);
              add(output);
             
              print = new JButton("Get Value");
              print.setBounds(20,200,100,20);
              print.addActionListener(this);
              add(print);
           
      }
     
      public void actionPerformed(ActionEvent e) {
             if(e.getSource()== print )
             {
                   output.setText(input.getText());
             }
      }
     
      public static void main (String[] args)
    {
            CreateTextbox me = new CreateTextbox();
         me.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         me.setVisible(true);
         me.setLocation(550, 500);
         me.setSize(300, 300);
         me. setTitle("Create Textbox");

    }

}



output:  




6 comments :

  1. great faizal keep it up fine good excellent jog ......................................................................................................................................................

    ReplyDelete
  2. I have read your blog its very attractive and impressive. I like it your blog.

    Java Training in Chennai Core Java Training in Chennai Core Java Training in Chennai

    Java Online Training Java Online Training Core Java 8 Training in Chennai Core java 8 online training JavaEE Training in Chennai Java EE Training in Chennai

    ReplyDelete
  3. I have read your blog its very attractive and impressive. I like it your blog.

    Java Online Training Java EE Online Training Java EE Online Training Java 8 online training Core Java 8 online training

    Java Online Training from India Java Online Training from India Core Java Training Online Core Java Training Online Java Training InstitutesJava Training Institutes

    ReplyDelete
  4. Thanks for the good words! Really appreciated. Great post. I’ve been commenting a lot on a few blogs recently, but I hadn’t thought about my approach until you brought it up. 
    python Training in Pune
    python Training in Chennai
    python Training in Bangalore

    ReplyDelete
  5. This looks absolutely perfect. All these tiny details are made with lot of background knowledge. I like it a lot. 
    Best Devops Training in pune
    Devops Training in Bangalore
    Power bi training in Chennai

    ReplyDelete
  6. Awesome! Education is the extreme motivation that open the new doors of data and material. So we always need to study around the things and the new part of educations with that we are not mindful.
    Data Science training in rajaji nagar
    Data Science with Python training in chennai
    Data Science training in electronic city
    Data Science training in USA
    Data science training in bangalore

    ReplyDelete

Copyright © Rough Record. Designed by OddThemes