This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Applets and the fly likes Menu Choice() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "Menu Choice()" Watch "Menu Choice()" New topic
Author

Menu Choice()

Mark Miranda
Greenhorn

Joined: Feb 25, 2011
Posts: 24
Hello!!!

I'm new to Java and making Applets and right now I have a choice() menu drop down menu that i'm using.



How can I make it so that when I choose Cat from the drop down, it displays a picture of a Cat? or if I choose do, it shows a picture of a Dog?

Thanks!
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41015
    
  43
Instead of menu.addItem("Cat") you would use something like this:

If you have lots of menu items then there are ways to make the code more compact, but this approach should get you going.


Ping & DNS - my free Android networking tools app
Mark Miranda
Greenhorn

Joined: Feb 25, 2011
Posts: 24
thank you for the help!
 
 
subject: Menu Choice()
 
Similar Threads
Doubts on the enhanced for loop, K&B p352
java applet crash with javascript dropdown menu
Choice choice = new Choice();
Having issues with sub menu causing main menu to not exit
instanceOf Compiler error