alice-teacher Alice 3 NetBeans Do-Together code issue

Daniel Abeshouse dabeshou at andrew.cmu.edu
Fri May 10 13:49:25 EDT 2024


Hello,

Good to see the plugin is being used.

When the palette entry is dragged in it not only adds the code, but also
makes sure there is a static import of the code it calls.
import static org.lgna.common.ThreadUtilities.doTogether;

Your code should work if you add the import by hand, or drag in a
doTogether block to trigger the addition.

Hope this helps.

Daniel Abeshouse

Alice Project
Carnegie Mellon University


On May 10, 2024 at 12:35:45 PM, Carlos Bovell via alice-teachers <
alice-teachers at lists.andrew.cmu.edu> wrote:

> Hi,
>
> We ran into a problem where we tried typing the doTogether syntax directly
> in MyFirstMethod in NetBeans. We received an error saying that the
> doTogether nethod is not recognized:
>
> C:\Users\cbovell\Documents\NetBeansProjects\PutFiveNumbersInOrder_starter_22\src\Scene.java:25:
> error: cannot find symbol
>             doTogether(() -> {
>   symbol:   method doTogether(()->{ this[...]0); },()->{ this[...]0);
> },()->{ this[...]0); },()->{ this[...]0); })
>   location: class Scene
>
> But when we drag over the control structure from the palette panel with
> the same exact syntax (honest!) it does work. Why would that be? What does
> dragging the doTogether over from the palette panel do that typing in the
> code does not do for NetBeans?
>
> This is the code we typed:
>
>         {
>             doTogether(() -> {
>                 this.dolphin.turn(TurnDirection.LEFT, 2.0);
>             }, () -> {
>                   this.dolphin2.turn(TurnDirection.LEFT, 2.0);
>             }, () -> {
>                     this.dolphin3.turn(TurnDirection.LEFT, 2.0);
>             }, () -> {
>                 this.dolphin4.turn(TurnDirection.LEFT, 2.0);
>             });
>         }
>
> This is the code from the dragged doTogether control structure:
>
>         doTogether(() -> {
>             //TODO: Code goes here
>             this.dolphin.turn(TurnDirection.LEFT, 2.0);
>         }, () -> {
>             //TODO: Code goes here
>             this.dolphin2.turn(TurnDirection.LEFT, 2.0);
>         }, () -> {
>             //TODO: Code goes here
>             this.dolphin3.turn(TurnDirection.LEFT, 2.0);
>         }, () -> {
>             //TODO: Code goes here
>             this.dolphin4.turn(TurnDirection.LEFT, 2.0);
>         });
>
> Thank you for taking my questions.
>
> Carlos Bovell
> Northern Burlington High School
> _______________________________________________
> alice-teachers mailing list
> alice-teachers at lists.andrew.cmu.edu
> To change settings or unsubscribe visit:
> https://lists.andrew.cmu.edu/mailman/listinfo/alice-teachers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.andrew.cmu.edu/pipermail/alice-teachers/attachments/20240510/b389a0b7/attachment.html>


More information about the alice-teachers mailing list