How to Earn Money ADFLY

Monday 20 February 2017

How To Add TextField In Java

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class Simple extends JFrame{
JTextField tx;
public Simple(){
setBounds(0,0,600,400);
setTitle("Simple Java Program");
setLayout(null);

tx=new JTextField("Hello");
tx.setBounds(30,50,200,20);

add(tx);//add the button
setVisible(true);
}
public static void main(String args[]){
JFrame f=new Simple();
}
}

No comments:

Post a Comment