I am working on a project for temperature control of a brewing process and had the wild idea to create a class for temperature UI which could be morphed into three different temperature scales for both deg F and deg C.
My problem is I can't figure how to embed the object into a form. I can instantiate my object in a new form but that's not what I think I want.
Is it possible in B4J v2.2?
You can't the class directly as it is not a Node. However you can expose the base node from the class and add it. Or you can create am AddToPane method in your class that adds the required nodes to the pane.
Since I built my first version in B4A using code it would be simpler for me to place a pane on my main form in Scene Builder then pass it as owner to my class. The "Initialize" method would place the nodes onto the owner pane. Other methods would fill in label.Text and rotate the temperature dial needle.
Would this be an object with encapsulated properties and methods? In other words if I instantiate tAmbient as an object would tAmbient.TemperatureDial_SetTemperature method rotate the needle in that instance alone and not affect other instances of the class?
I hate spaghetti.
Thanks Erel, I'm able to place nodes onto an anchorpane with relative ease. I notice that not all the properties are available when instantiating a node via code. In B4A I was able to change the font size and set gravity but I don't see those properties in B4J. That could be a deal breaker.