Receiver.java
import java.awt.*;
import java.awt.event.*;
import java.awt.datatransfer.*;
/** ButtonAndTextクラスを拡張した Receiverクラス */
public class Receiver extends ButtonAndText {
/** 使用するクリップボード */
public Clipboard clip;
/** コンストラクタ */
Receiver( Clipboard clip ) {
super( "Paste and Display", "Paste" );
this.clip = clip;
}
/** アクション処理のメソッド */
public void actionPerformed( ActionEvent evt ){
try {
StringSelection ss
= (StringSelection)clip.getContents( this );
textArea.setText(
(String)(ss.getTransferData( DataFlavor.stringFlavor )) );
}
catch( Exception e ) { }
}
}