-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rectangles are always all Green #65
Comments
I'll update the text to make it more clear. The code to make one of them
a different color is in 16.5. In 16.4, it is just drawing the rectangles.
Thanks for your comments to improve the book!
…--Alan
On Tue, Jan 2, 2024 at 9:36 PM FTC14169alpha ***@***.***> wrote:
Date on version you are commenting on
Jan 2, 2024
Section you are commenting on
16.4
Comments
Line 43 where the code states - Paint nonSelectedPaint = new
Paint(selectedPaint);Passing in selectedPaint to the constructor causes it
to over ride the red initially set and all rectangles end up Green just
doing new Paint() fixes the issue, however, you have to build up the
stroke, etc to match the Red box
—
Reply to this email directly, view it on GitHub
<#65>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAF3Y77PFA6OLF2QEYTA4SDYMS73PAVCNFSM6AAAAABBK2DSBKVHI2DSMVQWIX3LMV43ASLTON2WKOZSGA3DGMJWGYZDKNA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
I think when you pass This problem applies to BOTH Listing 16.5 in Section 16.4 and Listing 16.6 in Section 16.5. (perhaps it would be better to change to 16.4.1 and Listing 16.5.1 to make it less confusing) As a workaround, this code works:
I'm not a java expert at all, but the documentation for Paint(Paint paint) implies that the problem we are seeing should NOT occur. It says "Create a new paint, initialized with the attributes in the specified paint parameter" -- which implies that when you pass a However, at least here, it seems like they are not independent, since calling |
This is clearly working on my team's robot for this season so I am confused. Are you running this on a Control Hub? If so, what version? |
Hi @alan412, I saw this issue of all three rectangles being green (thus clobbering the original red) when running the code on EOCV-Sim, so maybe the problem stems from there. I thought I should chime in with more details after seeing the OP @ftc14169alpha report the same problem, but I'm not sure if they were running the code on EOCV-Sim vs an actual Control Hub. |
@hexaflexa - I put this in as a potential issue on EOCV-Sim |
Apologies! I became inactive for a while as I was dealing with end-of-highschool stuff. This should be a fairly quick fix, sorry for the overlook. |
Fixed in EOCV-Sim v3.4.3 |
The fix in EOCV-Sim 3.4.3 works, so I believe this issue can be closed. |
Date on version you are commenting on
Jan 2, 2024
Section you are commenting on
16.4
Comments
Line 43 where the code states - Paint nonSelectedPaint = new Paint(selectedPaint);Passing in selectedPaint to the constructor causes it to over ride the red initially set and all rectangles end up Green just doing new Paint() fixes the issue, however, you have to build up the stroke, etc to match the Red box
The text was updated successfully, but these errors were encountered: