The code below would work ok but only to send. If the values changed after sent then you could always send them back to the original source. If you wanted to implement a drag and drop scheme that would be another story.
Code:
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class F{
public static void main(String[] args){
JFrame sending = new JFrame("Sending");
JFrame receiving = new JFrame("Receiving");
JButton jb = new JButton("Send");
Container s = sending.getContentPane();
Container r = receiving.getContentPane();
JTextField js = new JTextField(10);
JTextField jr = new JTextField(10);
sending.addWindowListener(new WindowAdapter(){
public void widowClosing(WindowEvent evt){
System.exit(0);
}
});
receiving.addWindowListener(new WindowAdapter(){
public void widowClosing(WindowEvent evt){
System.exit(0);
}
});
jb.addActionListener(new Sender(js,jr));
s.add(js,BorderLayout.NORTH);
s.add(jb,BorderLayout.SOUTH);
r.add(jr,BorderLayout.NORTH);
sending.setSize(250,200);
receiving.setSize(250,200);
sending.setVisible(true);
receiving.setVisible(true);
}
}
class Sender implements ActionListener{
JTextField js;
JTextField jr;
public Sender(JTextField js,JTextField jr){
this.js = js;
this.jr = jr;
}
public void actionPerformed(ActionEvent evt){
jr.setText(js.getText());
}
}