This site requires JavaScript, please enable it in your browser!
Greenfoot back
programmer22
programmer22 wrote ...

2012/2/12

MENU?

programmer22 programmer22

2012/2/12

#
ok so i want a drop down menu or atleast i think thats what its called where its like one thing on another like this play <----- something like that any ideas on how i can begin or a scenairo u can share difficulty settings
danpost danpost

2012/2/12

#
The java api has in javax.swing a JMenu, a JMenuBar, and a JMenuItem sub-class set that could be used to create a menubar, but I do not think this is what you are after (after looking at the tutorials provided). My best suggestion is to create two classes extending Actor; one for the main text (play) called Menu, and one for the drop-down text items (difficulty and settings) called SubMenu. Add a method in Menu to recieve each line of text to show in the drop-down. Then in the act method, set it up so when clicked on, it create the SubMenu items with the appropriate texts (make it toggle; one click -- show subs, next click -- hide subs). When sub-menu items are clicked on, they can send the main menu class an integer value indicating which one was clicked (the Menu class can send the sub-menu item an integer tag when created, and the sub-menu class can save it for return if neccessary). When a valid integer is recieved in the Menu class, it can removed the SubMenu items and act according to what number was returned.
programmer22 programmer22

2012/2/12

#
well it doesnt have to be like that i thought i twould be nice have yoou seen the game my asteriod by dordor maybe something like that i was trying to open it in green foot and a terminal window came up and it wouldnt show it so yeh >.> but ill definatly try what you have said above
danpost danpost

2012/2/12

#
I checked out the asteroids scenario by dordor (downloaded it, removed a couple of music files, opened it in Greenfoot, adjusted code due to lack of music files, and ran it). The three items on the front screen are basically just buttons (not menus). In other words, each one did a specific task, without any choice by the user. A menu would require input from the user as to how to continue.
You need to login to post a reply.