John B. Matthews wrote:
In article <naidnTx3LaV08MnUnZ2dneKdnZydnZ2d@giganews.com>,
anon <anon@gmail.com> wrote:
Don't do everything in main(), or indeed in a static method. Use
purpose-built instance methods.
You need to use the pattern of creating objects with instance-specific
attributes, and expose those attributes publicly, ideally via getX() and
setX() methods (accessors and mutators, respectively).
[...]
So I need to create accessor and mutator methods for all my variables?
Forgive me but I don't really understand what you just said :)
The phrase "instance-specific attributes" refers, in this case, to the
variables that hold the current state of your simulation. The terms
"accessor" and "mutator" are more formal names for plain old "get..."
and "set...", respectively.
I was hoping it would only be a matter of sticking my relevant code in a
class somewhere and just be able to call it all, doesn't seem so :(
Well, your Main class only has has one method, main(), which sends it's
results to System.out. For your GUI, you need to get (access) the
results in order to put them in a text component. For example, your Main
has a feature identified as "Print Details of Current Caller." This
might be implemented as an accessor named getDetailsOfCaller(), and so
on.
it seems the other tutorials there would be useful, too.