aspose file tools
The moose likes Beginning Java and the fly likes choice field???? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide 1Z0-808 this week in the OCAJP forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "choice field????" Watch "choice field????" New topic

choice field????

raymond yadao
Ranch Hand

Joined: Jan 29, 2001
Posts: 88
hi, how would i make my choice field to behave like the select of html? in html, it has two inputs one for value and another for description.
<option value="PRO">PROVINCE</option>
<option value="REG">REGION</option>
how can i do it in choice so that when i select it will return the value(PRO)?in choice field there's a method getSelectedItem(returns the description) and getSelectedIndex(return the index)
Manfred Leonhardt
Ranch Hand

Joined: Jan 09, 2001
Posts: 1492
Hi Raymond,
It is not possible using the AWT Choice component. The Choice component only supports String object therefore you can only use the label displayed as the key to figure out which one was selected.
raymond yadao
Ranch Hand

Joined: Jan 29, 2001
Posts: 88
ok thanks...
jQuery in Action, 2nd edition
subject: choice field????