For this homework, you will write a Java class that reads through a text file of drawing commands and draws…

For this homework, you will write a Java class that reads through a text file of drawing commands and draws the appropriate shapes onto JFrames. The following commands must be supported

Don't use plagiarized sources. Get Your Custom Essay on
For this homework, you will write a Java class that reads through a text file of drawing commands and draws…
Get a PLAGIARISM-FREE custom essay written for you!
Order Essay


FRAME width height                          // sets up a new frame with given width and height (both integers)

COLOR red green blue                        // sets the current “pen color” to the color with the given rgb components.

RECTANGE x y width height             // draws a rectangle with upper left corner at x,y and given width and height (all // given in integers)

CIRCLE x y radius                                // draws a circle centered at x,y with given radius (as doubles)

ELLIPSE x y xradius yradius               // draws an ellipse centered at x,y with semi-radii xradius and yradius (Note:  
// these parameters are slightly different than that in Ellipse2D.Double’s
// constructor.

LINE x1 y1 x2 y2                                   // draws a line from x1,y1 to x2,y2 (as doubles)


A sample command paint_instructions.txt file is as follows:


FRAME 200 100                                   // open a frame, note: parser must ignore any comments

COLOR 255 0 0                                     // set color to red

RECTANGLE 20 30 40 20                    // draw a red rectangle

COLOR 128 128 128                             // set color to gray

CIRCLE 100 50 25                                 // draw a gray circle

FRAME 100 100                                   // open a second frame

COLOR 0 0 255                                     // set color to blue

ELLIPSE 50 50 30 20                             // draw a blue ellipse

COLOR 0 255 0                                     // set color to green

LINE 10 20 90 80                                   // draw a green line


For simplicity, there should be only one command per line which may end in a comment as shown above.


Your program should read commands and set up appropriate GUI structures in the Java Swing environment. If a command has a syntax error, then your program should detect this and print out a message to the output console indicating the line number from your command file that had the error. Hint: there is an easy way to do this by catching runtime exceptions that are thrown in a try block.

Homework Paper
Calculate your paper price
Pages (550 words)
Approximate price: -

Our Advantages

Plagiarism Free Papers

All our papers are original and written from scratch. We will email you a plagiarism report alongside your completed paper once done.

Free Revisions

All papers are submitted ahead of time. We do this to allow you time to point out any area you would need revision on, and help you for free.

Free Title-page

A title page preceeds all your paper content. Here, you put all your personal information and this we give out for free.

Free Bibliography

Without a reference/bibliography page, any academic paper is incomplete and doesnt qualify for grading. We also offer this for free.

Originality & Security

At Homework Sharks, we take confidentiality seriously and all your personal information is stored safely and do not share it with third parties for any reasons whatsoever. Our work is original and we send plagiarism reports alongside every paper.

24/7 Customer Support

Our agents are online 24/7. Feel free to contact us through email or talk to our live agents.

Try it now!

Calculate the price of your order

We'll send you the first draft for approval by at
Total price:

How it works?

Follow these simple steps to get your paper done

Place your order

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Receive the final file

Once your paper is ready, we will email it to you.

Our Services

We work around the clock to see best customer experience.


Flexible Pricing

Our prces are pocket friendly and you can do partial payments. When that is not enough, we have a free enquiry service.


Admission help & Client-Writer Contact

When you need to elaborate something further to your writer, we provide that button.


Paper Submission

We take deadlines seriously and our papers are submitted ahead of time. We are happy to assist you in case of any adjustments needed.


Customer Feedback

Your feedback, good or bad is of great concern to us and we take it very seriously. We are, therefore, constantly adjusting our policies to ensure best customer/writer experience.