Create a control panel of at least three widgets that allows the user to change the configuration of the game. Possible commands include:
Next, set up your game to allow the user to select any visual game object by clicking on it with the mouse. This means that you will first need to figure out which object the mouse touched (since the spaceship, asteroids, etc. are not Java widgets). Your program must therefore figure out which object was clicked on, by testing the mouse position against the boundaries of each of your objects.
Once an object is selected, the user should be able to:
Add a "Start" button to the game which will begin the game (with nothing moving until the next assignment). It should enable keyboard input for controlling your spaceship. It should also disable those control panel widgets that don't make sense to use in the middle of a game. But keep as many control panel widgets alive as you can, so that some commands are still possible even while the game is being played.
Add a scoreboard that contains widgets that are updated with information taken from the Game object. And include the scoreboard in your window layout.
(The rest of this still applies from the last assignment)
Your program design should exploit the features of object-oriented programming (encapsulation of code and data, support for abstract data types, polymorphism/overloading, inheritance). In particular, object-oriented programming provides us a good way to handle the various data needed in callback routines. You should use objects to encapsulate each interactive widget with the routines and data you need to use it.
You should provide an object for each interactive widget or small group of widgets you create. That object should hold anything you need to remember about the widget from one callback to another, all the data pertinent only to the command for that widget or that you need to operate this control, (including, in most cases, a pointer to the graph or other outside object to perform the actual action the user requested), and the widget's own listener callback routines.
If you have several widgets that share some behavior or properties, you should organize your objects into an appropriate inheritance hierarchy.
You will have other data that must be accessed by several widgets, particularly shared information about the state of the program or global information about the state of the user interface. Provide additional classes and objects for holding this kind of information.
Remember to trigger your drawing to repaint itself explicitly whenever one of your commands causes a change in the state of the graph that should be reflected on the screen. And remember that the way to change the screen is first to change the data stored in the Graph or other classes and then to trigger the repaint.
You should follow these general Java programming practices:
And, finally, for uniformity please name your Java class that has your main program in it Main, in file Main.java
ownwhich other objects)
usesor collaboration relationships (which objects use which other objects to perform functions)
secretsof each of your classes (i.e., what design decisions are entirely encapsulated within that class).
Submit this documentation electronically in text form. Include it as part of the readme file that you submit with your assignment.