This program is for creating java text filed
compilation: javac JTextFieldDemo.java
Run: appletviewer JTextFieldDemo.java
-----------------------------------------------------
CODE:
-----------------------------------------------------
import java.awt.*;
import javax.swing.*;
/* <applet code="JTextFieldDemo" width=200 height=50>
</applet>
*/
public class JTextFieldDemo extends JApplet{
public void init() {
// Get content pane
Container contentPane = getContentPane();
//Creating a Text filed
JTextField jtf = new JTextField(JTextField.CENTER);
// Add text field to content pane
contentPane.add(jtf);
}
}
--------------------------------------------------------------
OUTPUT:
--------------------------------------------------------------
compilation: javac JTextFieldDemo.java
Run: appletviewer JTextFieldDemo.java
-----------------------------------------------------
CODE:
-----------------------------------------------------
import java.awt.*;
import javax.swing.*;
/* <applet code="JTextFieldDemo" width=200 height=50>
</applet>
*/
public class JTextFieldDemo extends JApplet{
public void init() {
// Get content pane
Container contentPane = getContentPane();
//Creating a Text filed
JTextField jtf = new JTextField(JTextField.CENTER);
// Add text field to content pane
contentPane.add(jtf);
}
}
--------------------------------------------------------------
OUTPUT:
--------------------------------------------------------------