java - How do I access an attribute on an Applet Runnable Class? -


if i'm running right-click & "run file" don't need instantiate object of class.

but how access attribute class?... thread class example.

my program game 2 players have put ball in hoop.

it has work on sockets multiplayer.

i have:

  • 2 applet classes (1 per player) animation happens
  • socket server class
  • socket thread class (since need thread per player)
  • ball class manages location velocity values

i need access each of applet's miturn attribute serverthreads make true or false applet knows if should have mouse input on/off.

since it's applet don't create applet object somewhere else, run class file.

if you've got more toy program application have more simple applet object rather have multiple classes. solution base program on m-v-c or similar structure separate model view, , allow model's state obtainable through getter methods.

also class extends applet or japplet small, , concern applet creation , nothing else.


a side note: applets dead technology, oracle, arbiters of java, say, , don't want create these unless somehow antiquated job or school requirement. goes double if you're creating applet derived (awt) classes.