Is it possible to create get() and set() methods within a class created in Processing. Not that XML stuff for Processing that comes up on a Google search but actual getters and setters created with Processing as with Java proper or an equivalent OOP mid-level language.
As in: "float getFloat(float numX) {
return (xNum);
}"
That kind of thing.
I'm trying to create hotspots on a map which are represented by rectangles which will be made invisible but when the mouse hovers over them (so, in other words, when the map uses paths via an SVG file, which of course have classes and ids in them for reference) which makes this a harder task so I'm racking my brain trying to come up with a solution which creates the hotspots and then displays data using text superimposed on a rectangle. I'm also trying another solution of creating another map underneath the main one in which each state (the map is of the US) is its own hotspot instead of using rectangles to represent them.
A getter and setter seems like the most efficient solution at the moment but I can't try it out because Processing doesn't seem to like it (for the rectangle hotspot solution, I am trying to get the x and y positions and use those to calculate where the mouse is from there which would simulate a mousehover -- which also isn't already built into the code).
Does anyone know or can point to a tutorial/working example of how do to this. If you need code I'm using, I can provide that. I have been up since last night doing this so if anyone can help me out that would be so appreciated -- and full apologies if I've come off bad in tone here in this question.
I am very new to processing and I am just getting started in making sketches. I am trying to make an interactive map of the United States. I want to be able to click on a state and have a text box or text table appear with the details about the states voting patterns in previous elections. I have found the following code online and I know change the color of each state however, I do not know how to make a text box or text table appear when clicking on each state. Can any of you offer any advice, direct me to a website or provide any code that may help?
I'm new to Processing but to give you an idea of where I'm at, I have recoded the examples given in the Processing zip archive and done some Lynda.com tutorials and I'm starting to program my own sketches.
I'm still using examples right now, though. Using a map of united states sketch I recoded with some of my own features (different colors, text font and other basic stuff), now I'm trying to code a feature that when you hover the mouse over a state on the map, that a text box or pop-out box of some kind pops out and displays some data (obesity rates etc...).
Would coding it so that text is superimposed on a white rectangle that pops up be a good idea? Are there any examples online of how to go about doing this feature, any tutorials or any source code at all? The more detail, the better.