362392 txt editor
N/A
着払い
DUE 10/30/09 (Fri) 10:00 am (Eastern time)
Write a program with very basic text-editing capabilities. Create a JFrame with two JTextAreas. The first text area must be editable, the second one should not be editable. Your JFrame must also have two buttons, which should work as follows:
1. The first button should open up a file chooser dialog, allowing the user to select a text file that will be displayed in the editable text area. You can use a JFileChooser for this.
2. The second button provides the following functionality: The user selects some text in the first text area, and then when the second button is clicked, that text should appear in the second text area, clearing any text that was previously there. (It's like a Copy-and-Paste button in one, unlike the usual convention of having two separate buttons, one for Copy and one for Paste.)
Since the files can be larger than the text areas, you will need to give them scroll bars. This may be accomplished by placing each area in a JScrollPane.
Note that all this functionality can be easily by tying together standard functions in the Swing libraries. You should spend some time exploring the documentation for JTextComponent, JTextArea, JFileChooser and so on. You are highly encouraged to look at the Swing tutorial on the Java website
[url removed, login to view]
which contains a huge amount of explanatory content, examples, and sample code. Every single thing you need to know to complete this assignment can be learned from these two resources.
Deliverables
You must submit the source code (The .java files, not the .class files) for the programs.
Restrictions
Your program must compile using Java 6.0 or later. It's okay to develop your program using the IDE of your choice, although Eclipse is recommended. Your program should include comments!
プロジェクトID: #2108228