Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Menu Choice()

 
Mark Miranda
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42968
73
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Mark Miranda
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you for the help!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic