I created a class test with many data members of which one is a JTextField called myField. During the construction, I create a blank text field.
My problem is that, the contents of the text field never changes after construction if I use setText method.
class test extends JPanel
{
private JTextField myField;
public test()
{
//constructer
}
private void setTheLayout()
{
// did layout positioning for myField
add(myField);
}
private void setAValue() //called on a button click
{
myField.setText("Hello world");
}
}
How to solve this?