The Artima Developer Community
Sponsored Link

Java Answers Forum
java combobox

2 replies on 1 page. Most recent reply: Dec 17, 2004 3:38 AM by mausam

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 2 replies on 1 page
Lydia

Posts: 1
Nickname: private
Registered: Oct, 2004

java combobox Posted: Oct 31, 2004 5:47 PM
Reply to this message Reply
Advertisement
Anyone know how to program a key selection for a jcombobox? Or do you know where I can look at sample code for coding it? Thanks


Matthias Neumair

Posts: 660
Nickname: neumi
Registered: Sep, 2003

Re: java combobox Posted: Nov 8, 2004 7:34 AM
Reply to this message Reply
What do you mean by Key selection?
The displayed text should be different from the return value?

You need 2 things for that:

1. a class wich containes the key and the display string (I created a class called ComboBoxString containing key, text and icon
2. a renderer for the ComboBox. It should extend the standard-renderer.When called, it should check if the item is a ComboBoxString, then create a panel with the icon and the text. If it's something else, it should simply call the render-method of the super class.

mausam

Posts: 243
Nickname: mausam
Registered: Sep, 2003

Re: java combobox Posted: Dec 17, 2004 3:38 AM
Reply to this message Reply
Do u mean adding a key listener?

Flat View: This topic has 2 replies on 1 page
Topic: Adding, removing, searching of an array Previous Topic   Next Topic Topic: Externalizing Strings for *Any* File?

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use