Package a6
Class GameMain
java.lang.Object
a6.GameMain
Main class for Click-a-Dot game. Creates window with game board, score label, start button, and
sliders for target size and speed.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprivate static void
addSliderLabels
(JSlider slider, String minLabel, String maxLabel) Label `slider`'s minimum value with `minLabel` and its maximum value with `maxLabel`.private static void
Create application window.static void
Start the application.private static JComponent
makeSliderPanel
(JSlider slider, String title) Place `slider` in a new padded panel with top label `title` and return the panel.private static void
Append a line containing `score` to a user-selected file, using `frame` as the parent of any dialogs.
-
Constructor Details
-
GameMain
public GameMain()
-
-
Method Details
-
main
Start the application. -
createAndShowGUI
private static void createAndShowGUI()Create application window.- Window title is "Click-a-Dot"
- Game board is in center of window, expands to fill window size
- Score label is at top; text is centered
- Start button is at bottom
- Size slider is at right
- Speed slider is at left
-
addSliderLabels
Label `slider`'s minimum value with `minLabel` and its maximum value with `maxLabel`. -
makeSliderPanel
Place `slider` in a new padded panel with top label `title` and return the panel. -
saveScore
Append a line containing `score` to a user-selected file, using `frame` as the parent of any dialogs. Show an error dialog if a problem occurs when writing the file.
-