How to Drop Popups with given info

I get confused on this step of the homework and the function is supposed to:

“The behavior of this method should be as follows:
Given data on one earthquake, and the x, y coordinates of the center of its corresponding circle, draw a rectangular “popup” that contains the “title” text”

Here is what I have so far

void drawPopup(JSONObject datum, int x, int y) {
  draw (fill(180, 180, 180);
  rect(x+5, y+10, 50, 20) String Title;
}
1 Like

please format your code:

  • in processing IDE use [ctrl][t]
  • in forum editor press the
</> code tag

and get the

```
paste your code in here
```

or just use keyboard and type the 2 lines with the ```


but sorry, that code what you show is not worth posting,
insofar only shows your current status in respect of learning Processing and possibly
also, your problem to find/learn from examples ( and the reference )
https://processing.org/reference/ like:
https://processing.org/reference/draw_.html
https://processing.org/reference/fill_.html
https://processing.org/reference/rect_.html
https://processing.org/reference/loadJSONObject_.html

i hope you not try with this to find someone here to write/code the homework for you.
! we are not allowed to! ( like some teachers say we would help you cheating… )

so again, we can help with commands, ideas, tips… but
the code you post should run so we can test it here,
but it looks like you not even try to type that in the IDE and work on the errors
you must get.

1 Like

When you put that in the Processing PDE, what specific messages does the Errors tab show you? Maybe start with the first one, and try to fix them one at a time.

You may also want to look at the introduction tutorial before looking at the reference – the way you are using draw() suggests you’ve never read an intro to Processing or looked at the first examples. Try:

Or, if you prefer video, watch:

https://hello.processing.org/

Also related to your previous post: Need Help with the boolean and making titles