AppletTalk.com Forum Index AppletTalk.com
Java discussions newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Overwrite combobox to accept objects in constructor

 
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java GUI Toolkits
View previous topic :: View next topic  
Author Message
Greg
Guest





PostPosted: Thu Nov 25, 2004 7:17 am    Post subject: Overwrite combobox to accept objects in constructor Reply with quote



Hi,

I've created ComboBox and passed in constructor vector with some
objects. This way combobox for each object in vector invokes method
toString (this is what user sees). How can I overwrite this method, I
mean I'd like to write to ComboBox not result of calling toString but
rather result of some other function in object.
Back to top
Andrew Thompson
Guest





PostPosted: Thu Nov 25, 2004 7:26 am    Post subject: Re: Overwrite combobox to accept objects in constructor Reply with quote



On 24 Nov 2004 23:17:09 -0800, Greg wrote:

Quote:
I've created ComboBox ..

Are you referring to JComboBox? Please be specific..
<http://www.physci.org/codes/javafaq.jsp#specific>

Quote:
..and passed in constructor vector with some
objects. This way combobox for each object in vector invokes method
toString (this is what user sees). How can I overwrite this method,

You do not need to, use a custom ListCellRenderer..
<http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/JComboBox.html#setRenderer(javax.swing.ListCellRenderer)>

Quote:
..I
mean I'd like to write to ComboBox not result of calling toString but
rather result of some other function in object.

Call whatever method you like from the LCR.

HTH

--
Andrew Thompson
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.LensEscapes.com/ Images that escape the mundane

Back to top
Display posts from previous:   
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java GUI Toolkits All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.