Re: Overwrite combobox to accept objects in constructor
From: Andrew Thompson (SeeMySites_at_www.invalid)
Date: 11/25/04
- Previous message: Greg: "Overwrite combobox to accept objects in constructor"
- In reply to: Greg: "Overwrite combobox to accept objects in constructor"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 25 Nov 2004 07:26:56 GMT
On 24 Nov 2004 23:17:09 -0800, Greg wrote:
> I've created ComboBox ..
Are you referring to JComboBox? Please be specific..
<http://www.physci.org/codes/javafaq.jsp#specific>
>..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)>
>..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
- Previous message: Greg: "Overwrite combobox to accept objects in constructor"
- In reply to: Greg: "Overwrite combobox to accept objects in constructor"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]