Well, you would have something relative to the following.
Java
FirstFrame first = new FirstFrame();
SecondFrame second = new SecondFrame();
// The FirstFrame class is your chat window, which
// will receive the text that you copied.
// The SecondFrame class has a textfield that you want to
// copy from eventually, correct? Look at the next codebox
// to see a very basic sample of a SecondFrame class.
Java
class SecondFrame extends JFrame
{
String textToCopy;
JTextField text;
//...constructors, other methods, etc.
public void setText()
{
textToCopy = text.getText(); //get the TextField text
}
public String getCopiedText()
{
return textToCopy;
}
}
Then, later in the program, when you want to copy the text over...
Java
// recall back to the first codebox
// TEXTFIELD is the place you want to set your text in.
first.TEXTFIELD.setText( second.getCopiedText() );
Hope this helps!
This post has been edited by Locke: 16 Mar, 2009 - 10:19 PM