
how to set the value of textfield constant

Java Set the value of textfield constant:
import javax.swing.*;
class ConstantText{
public static void main(String[] args){
JFrame f=new JFrame();
f.setLayout(null);
JTextField text=new JTextField(20);
text.setText("Hello");
text.setEditable(false);
text.setBounds(10,10,100,20);
f.add(text);
f.setVisible(true);
f.setSize(300,100);
}
}
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.