Original Post
Hey folks!
Long time reader, first time writer. If this be the wrong place for this topic (beginner problem, mayhaps?), please excuse me.
I'm currently writing a simple 2D game prototype, which will offer user interaction mainly from menu selections with the mouse.
This means that the user sees a list of buttons and clicking one of them either opens a new menu or window (whithin the gamepanel) and so forth.
Consider a button that when clicked needs to change the visibility state of another menu and at the same time turn it's parent container (menu) invisible.
I tried my own implementation from scratch, but it has turned fairly ugly with a lot of if-statements and questionable callback functions. Thus I wonder,
what is best practice when creating a menu system? Java Swing already contains good components such as buttons, was thinking about using
them together with local event handler classes for performing action.
This problem is probably trivial, but I'm yet inexperienced with regards to programming.
Long time reader, first time writer. If this be the wrong place for this topic (beginner problem, mayhaps?), please excuse me.
I'm currently writing a simple 2D game prototype, which will offer user interaction mainly from menu selections with the mouse.
This means that the user sees a list of buttons and clicking one of them either opens a new menu or window (whithin the gamepanel) and so forth.
Consider a button that when clicked needs to change the visibility state of another menu and at the same time turn it's parent container (menu) invisible.
I tried my own implementation from scratch, but it has turned fairly ugly with a lot of if-statements and questionable callback functions. Thus I wonder,
what is best practice when creating a menu system? Java Swing already contains good components such as buttons, was thinking about using
them together with local event handler classes for performing action.
This problem is probably trivial, but I'm yet inexperienced with regards to programming.