Hello, I am trying to change the text of a JTextArea from another class, for that create a method that takes care of it, the problem is that when I create the object of the class where the field of type JTextArea is and I try to change it the text with setText () is not displayed at all, but if I print it in the console if the text that I put with the method appears, here the code
Object declaration:
private JTextArea area1;
Initialization:
area1 = new JTextArea();
Giving it size:
area1.setBounds(20, 200, 500, 160);
Add it to the picture:
add(area1);
Here the method with which I try to change the text:
public void setRegistro(String registro) {
area1.setText(registro);
}
Creating the object from the other class:
laminaVista vista1 = new laminaVista();
try{
//codigo no relevante
}catch(IOException e){
vista1.setRegistro("Mensaje de error");
}