forked from patniemeyer/learningjava
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSharedModel.java
More file actions
26 lines (21 loc) · 812 Bytes
/
Copy pathSharedModel.java
File metadata and controls
26 lines (21 loc) · 812 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
//file: SharedModel.java
import java.awt.*;
import javax.swing.*;
public class SharedModel {
public static void main(String[] args) {
JFrame frame = new JFrame("Shared Model");
JTextArea areaFiftyOne = new JTextArea( );
JTextArea areaFiftyTwo = new JTextArea( );
areaFiftyTwo.setDocument(areaFiftyOne.getDocument( ));
JTextArea areaFiftyThree = new JTextArea( );
areaFiftyThree.setDocument(areaFiftyOne.getDocument( ));
Container content = frame.getContentPane();
content.setLayout(new GridLayout(3, 1));
content.add(new JScrollPane(areaFiftyOne));
content.add(new JScrollPane(areaFiftyTwo));
content.add(new JScrollPane(areaFiftyThree));
frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
frame.setSize(300, 300);
frame.setVisible(true);
}
}