package org.best.example;
/*
JTextField Disable Enable Example
This java example shows how to enable or disable JTextField
using Java Swing JTextField class.
*/
import java.awt.FlowLayout;
import javax.swing.JApplet;
import javax.swing.JTextField;
/*
<applet code="JTextFieldDisableExample" width=200 height=200>
</applet>
*/
public class JTextFieldDisableExample extends JApplet{
public void init(){
//set flow layout for the applet
this.getContentPane().setLayout(new FlowLayout());
//create new JTextField
JTextField field = new JTextField("JTextField Disable Enable Example",20);
/*
* To disable JTextField use
* void setEnabled(boolean enabled)
* method with false argument.
*/
field.setEnabled(false);
/*
* To set the disabled JTextField enable, use the same method
* with the true argument.
*/
//field.setEnabled(true);
add(field);
}
}
/*
JTextField Disable Enable Example
This java example shows how to enable or disable JTextField
using Java Swing JTextField class.
*/
import java.awt.FlowLayout;
import javax.swing.JApplet;
import javax.swing.JTextField;
/*
<applet code="JTextFieldDisableExample" width=200 height=200>
</applet>
*/
public class JTextFieldDisableExample extends JApplet{
public void init(){
//set flow layout for the applet
this.getContentPane().setLayout(new FlowLayout());
//create new JTextField
JTextField field = new JTextField("JTextField Disable Enable Example",20);
/*
* To disable JTextField use
* void setEnabled(boolean enabled)
* method with false argument.
*/
field.setEnabled(false);
/*
* To set the disabled JTextField enable, use the same method
* with the true argument.
*/
//field.setEnabled(true);
add(field);
}
}
No comments:
Post a Comment