From: Jeff E. <JEm...@lg...> - 2003-03-11 16:41:42
|
This works because the data in the combo box are colors. You can modify it to get a color for a value. from javax.swing import * from java.awt.Color import * data = [red, blue, green] cb=JComboBox(data) class ColorfulRenderer(plaf.basic.BasicComboBoxRenderer): def getListCellRendererComponent(self,theList,value,index,sel,focus): comp = plaf.basic.BasicComboBoxRenderer.getListCellRendererComponent(self,theList,v alue,index,sel,focus) comp.foreground=value return comp cb.renderer=ColorfulRenderer() f=JFrame() f.contentPane.add(cb) f.pack() f.show() > -----Original Message----- > From: Patrick Bielen [mailto:bi...@st...] > Sent: Tuesday, March 11, 2003 8:57 AM > To: 'Jython Users' > Subject: [Jython-users] rendering and combobox > > > Hi guys, > > Does anybody in here has an example of how to add > colored items (text) to a combobox ??? > > I know how it is in java, but i'm not able to > jythoneze it, and i'm not a java programmer, so > that means i get stucked, hope somebody can help. > > Greetings > > Patrick > > > > > > ------------------------------------------------------- > This SF.net email is sponsored by:Crypto Challenge is now open! > Get cracking and register here for some mind boggling fun and > the chance of winning an Apple iPod: > http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en > _______________________________________________ > Jython-users mailing list > Jyt...@li... > https://lists.sourceforge.net/lists/listinfo/jython-users > |