Hi.
I overrided paint() to draw start menu for one game that I’m working on. I work with .png pictures by drawing background picture and then tekst picture on it, dependable where I am in start menu (at begining, in options submenu or somewhere else). When I click on some of the buttons, variable that remembers where I am in start menu changes accordingly and I call repaint(). In overriden paint() that is done with switch statement for different cases depending where I am.
So at begining of game start manu is drawn (start game, options, quit …), if I click on let’s say options then where_am_i variable changes to flag that I’m in options submenu and in paint() I use switch (where_am_i) to draw adequate picture for options submenu. Think sort of works, but not entirely…
When I click anywhere on button insted of previous picture of menu to disappear and new one to appear, the new one appears over the previous one. When I minimize and restore game it’s drawn as it shuold, only one picture (right one). Clearly I don’t know how (re)paint() works… I don’t understand why when I call repaint() the new picture is drawn on top of everything else instead that application draws everything from square?
One more thing, is there a better or simpler way to do start menus for games? The game itself is run in seperate thread and has active rendering, and I don’t want to do that on something so simple as start menu.
Thanks everybody.