Write a program that contains two frames one with a column


Write a program that contains two frames, one with a column of text fields containing numbers, and another that draws a bar graph showing the values of the numbers. When the user edits one of the numbers, the graph should be redrawn. Use the OBSERVER pattern. Store the data in a model. Attach the graph view as a listener. When a number is updated, the number view should update the model, and the model should tell the graph view that a change has occurred. As a result, the graph view should repaint itself.

Improve Exercise 7.1 by making the graph view editable. Attach a mouse listener to the panel that paints the graph. When the user clicks on a point, move the nearest data point to the mouse click. Then update the model and ensure that both the number view and the graph view are notified of the change so that they can refresh their contents. Hint: Look up the API documentation for the MouseListener interface type. In your listener, you need to take action in the mousePressed method. Implement the remaining methods of the interface type to do nothing.

Attachment:- Java.rar

Solution Preview :

Prepared by a verified Expert
JAVA Programming: Write a program that contains two frames one with a column
Reference No:- TGS02382977

Now Priced at $20 (50% Discount)

Recommended (95%)

Rated (4.7/5)