I was looking at the library ControlP5 (which implements an interface containing buttons, textfields, checkboxes, etc). I found this piece of code in the example of a textfield :
A few lines later, a custom function is called when the textfield is activated :
public void textin(String theText) { ...
I'm amazed that the function is related to the argument of the constructor. You can actually change it, like passing the String "foo" will call the function foo. Can someone explain me how this is done ?
I'm making an interface for my game and I want to use the java.awt.Component subclasses, like TextComponent. I thought of extending it to my own class to display in Processing, using the existing fields and methods. But how can I see the exact content of this class ? The doc from Oracle gives the methods but hides most of the fields, like I don't know the name of the String object used to store the text. I'd like to open the JDK classes and see their code, so I know what I have to write. Where to find them ?