 |
AppletTalk.com Java discussions newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Greg Guest
|
Posted: Thu Nov 25, 2004 7:17 am Post subject: Overwrite combobox to accept objects in constructor |
|
|
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
|
Posted: Thu Nov 25, 2004 7:26 am Post subject: Re: Overwrite combobox to accept objects in constructor |
|
|
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 |
|
 |
|
|
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
|
|