Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.

Categories

+21 votes
asked in CSC335 Fall 2022 by (1 point)

3 Answers

+14 votes

There are multiple possible solutions, but one approach is to pass a reference to the checkbox into the CreationTool's constructor, then store it as an instance variable, so that inside of the mouse click handling method you then have a reference to the checkbox and so you can check if the checkbox is selected.

If it is, you can modify the new figure to be twice as big (before it gets added to the Drawing).

(Note: a similar approach can be used for choosing a Color for the next figure that gets created.)

answered by (3.5k points)
+11 votes

I add a CheckBox as a data field of CreationTool class. In the mousePressed method of CreationTool, there will be a if statement: if the box is checked, set size of the newFigure to be twice as large as normal.

answered by (1 point)
+10 votes

Yes, I did. I made some changes in the CreationTool class.

answered by (1 point)
+4

what changes?

...