4 Replies - 262 Views - Last Post: 01 March 2013 - 08:48 PM Rate Topic: ***** 1 Votes

#1 ShroomiaCo  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 21
  • Joined: 13-January 13

Java State Machines, and their Uses

Posted 27 February 2013 - 03:39 PM

I am having difficulty understanding State Machines, even after looking at Dogstopper's tutorial on them, I am still do not understand them. More specifically, there are some parts of the code in that tutorial like SpaceFrame and the listeners. I understand how listeners work, but for some reason I do not get this one. :(/>

I am trying to figure out how to use them for further application, so there is no goal as of yet, but one thing I am trying to do is make a menu that can take you to different points in the program (e.g. Help)

On a side, I would like to know whether or not state machines are a good choice for programs, if so what kinds.

I have tried several approaches but most of them got cluttered and/or too complicated.

Any help would be greatly appreciated as I have been struggling with these for a while.

Is This A Good Question/Topic? 1
  • +

Replies To: Java State Machines, and their Uses

#2 farrell2k  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 823
  • View blog
  • Posts: 2,531
  • Joined: 29-July 11

Re: Java State Machines, and their Uses

Posted 27 February 2013 - 03:51 PM

Try Mac's tutorial. I thought it was good.
Was This Post Helpful? 2
  • +
  • -

#3 ShroomiaCo  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 21
  • Joined: 13-January 13

Re: Java State Machines, and their Uses

Posted 28 February 2013 - 04:51 PM

Thanks, helped a little. And I put the wrong link ;)My link
Was This Post Helpful? 0
  • +
  • -

#4 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8327
  • View blog
  • Posts: 31,857
  • Joined: 06-March 08

Re: Java State Machines, and their Uses

Posted 28 February 2013 - 08:42 PM

State machine can be simply resume:
- you are in a State
- an event happens
- you react to it
- you end up in a state (may be the same one)

My teacher (30 years ago had a macho analogy but I always remember it)

- you are sleeping
- baby cries
- wake up wife
- go back to sleep

still works
Was This Post Helpful? 0
  • +
  • -

#5 ShroomiaCo  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 21
  • Joined: 13-January 13

Re: Java State Machines, and their Uses

Posted 01 March 2013 - 08:48 PM

Thanks to all of you, buuuut I managed to figure it out through a weird process of experimentation and it works now....
Thanks anyways.
Yay for state machines.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1