Question: I need a Java application that can read text files containing lists of points in a two-dimensional space and display those points in a graphics

I need a Java application that can read text files containing lists of points in a two-dimensional space and display those points in a graphics window. The points will be provided as pairs of numbers (integer) representing the X (horizontal) and Y (vertical) positions in a Cartesian coordinate system. The first line of the text file will be an integer indicating the number of point positions, N. The next N lines will be a pair of values (one point per line), each value preceded by zero or more spaces with the two values separated by a comma, as shown here:

6 -3, -3 0, 0 2, 50 5, -15 20, 42 

Program must accomplish the following:

Read the text file. The user will be allowed to specify the file name and file path by using a "File Open" dialog box. Display the points. Program should read the point set, determine an appropriate scale, and display the points in a graphics window. Line segments must be drawn between the points in the order they appear in the text file.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!