I want to access JTextField of a class from another class , From the new class i want to setText to the textField.
from class patient_details i want to access the JTextField present in class Admission_screen. This is code which i used in patient_details class to add text in text field present in admission_screen class.
Admission_screen admit=new Admission_screen();
admit.t2.setText("xxx");
t2 is the textfiels present in admission_screen class.
this is not working help me with your suggestions
Add this method to Admission_screen
:
public void setT2Text(String text){
t2.setText(text);
}
Call it using the admit object you created. Like so:
admit.setT2Text("txt");