I’m learning Java, and now that I’m over the packages hump, things are going smoothly. I can draw similarities between most things I’m learning with things I already know at least the concept of. But what on earth is going on with the following bit of code? Is it some form of constructor, or anonymous object?
Something obj = new Something()
{
private static final int num = 3;
public void meth()
{
// w/e
}
};
Now, when I actually define my buttons, I do this. By providing the one line it needs, the only thing that makes it different from others. Now I could make a new file for each one, and define a new class for each one. This is much simpler.
Now, when I handle the buttons being pressed, remember back in the definition of TopButton… there was
We know
triggerEvent()eventually gets defined. We can define it on a per-button basis, and when the panel gets clicked, no matter what we definedtriggerEvent()to be, it gets called.