Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This assignment is designed to test your understanding of writing a basic graphical user interface (GUI) in Java. The key concepts are Swing components, event-driven

This assignment is designed to test your understanding of writing a basic graphical user interface (GUI) in Java. The key concepts are Swing components, event-driven programming with action events, layout management, input/output, and exception handling.

The scenario for this assignment is as follows: Macrosoft's experiment distributing its browser via sewer rats was an abysmal failure due to the company's unwise choice of Randy the RandomRat to carry the CDs. To recover the lost revenue from this marketing disaster, Macrosoft has decided to enter the office product market with a new word processor named JavaPad XP (tm). Because of your solid work on past projects, you have been selected to write the JavaPad graphical user interface.

Unlike your past projects, there are no provided files from other employees; you're flying solo on this one! Macrosoft does ask, however, that you again use JBuilder 6; your project name is JavaPad. Your project's "main" class (the class with the main method that runs the program) should be named RunJavaPad and should go

in the javapad package. You are also requested to put classes related to the graphical user interface into a package named javapad.gui. Beyond this, you may name your classes, methods, etc. as you like, as long as the names are representative and meaningful.

image text in transcribed

When the JavaPad program runs, your main window should appear and should have the following properties:

The window title should be: Macrosoft JavaPad XP

The window should start in its default position in the top-left corner of the screen, at pixel position (0, 0).

The window should be resizable.

When the window is closed, the program should terminate.

The content pane of the window should contain the following components:

A label of Macrosoft's company slogan: Macrosoft: Resistance is futile. This label lies in the center of the bottom area of the window. It should stay centered as the window resizes.

A text area in the center of the window. The text area should be initialized with 15 rows and 25 columns. The area is initially blank (contains no text). Long lines should wrap around to the next line. The area becomes scrollable, with a visible vertical scroll bar, when its contents become bigger than the area itself. (The screen shot above at right shows an example.) Its contents can be saved, loaded, and cleared as described below.

Three buttons in the top area of the window, centered horizontally, with the following labeling and click actions:

New: clears text in the main text area

Save: writes text that's currently in the main text area into the file hardcode.txt

Load: reads the file hardcode.txt if possible and places its text into the main text area

Quit: prompts to save, then exits the program

The prompt should be a "confirm dialog" option pane with Yes and No options, with title Quit and message Quitting; Save? The prompt should be a modal child of the JavaPad window. If the user chooses Yes, the program should save the text area's text to hardcode.txt and exit; If the user chooses No, the program should simply exit without saving anything.

(Note that the prompt to save only pops up if the user hits Quit, not if the user closes the window in any other way, such as pressing Alt+F4 or hitting the "X" button at the top-right corner of the window.)

image text in transcribed Properties of the window, continued:

The window should be sized exactly to fit the preferred size of the components in it, regardless of platform.

As the window resizes, the buttons and slogan label remain centered horizontally. The buttons and label do not change size as the window resizes. The text area expands to fill all available space as the window resizes. The screenshot below is an example:

image text in transcribed

Your program should not throw exceptions on failed I/O during save and load operations. When an I/O operation causes an exception (for example, when the file to read isn't found), it should be handled by your program by showing a modal "error option" option pane with title I/O Error and message Could not access file hardcode.txt ; the screenshot to the right provides an example.

Your directions ask that you follow good style guidelines as described in your previous projects, such as encapsulation and access, comments, indentation, spacing, and identifier names, and argument checking. For this project, you are asked to comment using the Javadoc commenting style, with a comment

image text in transcribed

block on each public class and method; description summaries, as well as use of tags @author, @param, and @return, are required where appropriate.

You are cautioned that various aspects of the program, such as constant strings, numbers and names, could change at a later date, so you are advised to make them into static final constants. These constants should be used throughout the program instead of their literal value.

You should also exercise good object-oriented design in your program. Encapsulate state and behavior intelligently into classes, and represent related/reused code intelligently in methods.

The following is a partial list of Java packages and classes may help you in writing this project:

package java.awt

BorderLayout, FlowLayout, Container

package javax.swing

JFrame, JPanel, JButton, JTextArea, JLabel, JOptionPane, JScrollPane

package java.awt.event

ActionEvent, ActionListener

package java.io

InputStream, InputStreamReader, BufferedReader, OutputStream, PrintStream, IOException

Macrosoft JavaPad XP New SaveLoad Quit The Linux OS is the highest visibility product of t he Open Source Soware (OSS) process. Linu represents a best-of-breed UNK, that is trusted in mission critical applications, and due to it's open source code has a long term credibilityw ich exceeds many other competitive OS's Linu is technically just a kernel, not the entire supporting OS. In order to create a usable produ ct, Linux"distributions" are created which bundl e the kernel, drivers, apps and many other com onents necessary for the full UNIXIGUI experien ce Linux poses a significant near-term revenue thr Macrosoft: Resistance is futile

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design Application Development And Administration

Authors: Mannino Michael

5th Edition

0983332401, 978-0983332404

More Books

Students also viewed these Databases questions