//file: SharedModel.java
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class SharedModel extends JFrame {
public SharedModel( ) {
super("SharedModel v1.0");
setSize(300, 300);
setLocation(200, 200);
JTextArea areaFiftyOne = new JTextArea( );
JTextArea areaFiftyTwo = new JTextArea( );
areaFiftyTwo.setDocument(areaFiftyOne.getDocument( ));
JTextArea areaFiftyThree = new JTextArea( );
areaFiftyThree.setDocument(areaFiftyOne.getDocument( ));
Container content = getContentPane( );
content.setLayout(new GridLayout(3, 1));
content.add(new JScrollPane(areaFiftyOne));
content.add(new JScrollPane(areaFiftyTwo));
content.add(new JScrollPane(areaFiftyThree));
setVisible(true);
}
public static void main(String[] args) {
JFrame f = new SharedModel( );
f.addWindowListener(new WindowAdapter( ) {
public void windowClosing(WindowEvent we) { System.exit(0); }
});
f.setVisible(true);
}
}
|