I have two class. One class is for JAVA text area another class has a object. I want to print in the textarea from another class. The class with the text area.
public class LabelStatus extends JPanel {
/**
*
*/
private static final long serialVersionUID = 1L;
final static JTextArea test =new JTextArea(40, 60);
public LabelStatus() {
JLabel title = new JLabel ("INCOMING MESSAGES ",JLabel.CENTER);
title.setFont(new Font ("Serif", Font.BOLD,30));
this.add(title);
GridBagConstraints k = new GridBagConstraints();
k.gridx = 10;
k.gridy = 10;
test.setLineWrap(true);
test.setWrapStyleWord(true);
test.setEditable(false);
JScrollPane spane = new JScrollPane(test);
spane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
GridBagLayout gbl = new GridBagLayout();
gbl.setConstraints(spane,k);
JPanel panel = new JPanel(gbl);
panel.add(spane);
add(panel);
}
public final id WriteOnPanel(final dataclass mrcc)
{
test.setText("\n THE STATUS " + mrcc.getMainState().value());
}
}
In this class I want to use the WriteOnPanel function to write my object.
In the other class I have the function which call WriteOnPanel to write some thing.Like this
LabelStatus.WriteOnPanel(mradarcontrolcommand);
Looks like I cannot write the object in the JTEXTAREA.
Please let me know how to deal with it.