• Post Reply Bookmark Topic Watch Topic
  • New Topic

Combo Box help...

 
Keyser Logue
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Want to produce a splash screen for my code.

It will utilise a combo box, which dependant on which one is selected will run a different class.

All the information on the internet regarding combo boxes shows the word "pig" in the box, which when selected displays a picture of a pig. How do I change this so that instead showing a picture, it will actually run a program?
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Keyser Logue:
... All the information on the internet regarding combo boxes shows the word "pig" in the box, which when selected displays a picture of a pig. How do I change this so that instead showing a picture, it will actually run a program?

I doubt that "all the information on the internet ... shows the word 'pig' in the box," although Sun's Swing tutorial does.

The key is in how an ActionListener object handles events from the Combo Box. In the Sun example, the picture is changed by calling updateLabel from within the actionPerformed method. But you can implement your own actionPerformed method to do what you choose.
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to the Swing forum...
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> All the information on the internet regarding combo boxes shows the word "pig" in the box,

do a search of this forum, sun's forums or google for
"new JComboBox"
include the quotes

the results should be sample code, often fully working programs
that you can copy/paste/compile/run
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!