Friday, 1 January 2016

How to implement a TextField in java

To implement text field use following code


import javax.swing.*;
import java.awt.*;
public class JTextClass

  public static void main(String[] args)
     JFrame f1;

     f1 = new JFrame("Welcome");

     JLabel l1 = new JLabel("Name");

     JTextField tf1 = new JTextField(20);

     JButton b1 = new JButton("Submit");
     f1.setLayout(new FlowLayout(FlowLayout.LEFT));



No comments:

Post a Comment