I have two JFrames A, and B. B has a textArea. I want to add some text to that TextArea in B by clicking a button in A. here is my code:
JButton btn = new JButton("Text");
btnButton_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
b.textArea.setText("Button clicked");
}
});
btnButton_1.setBounds(10, 45, 89, 23);
frmA.getContentPane().add(btnButton_1);
- b is object of class B
- textArea is JTextArea variable name in class B