#1 JComboBox Objects

open
nobody
None
5
2006-10-12
2006-10-12
bus-e
No

I have noticed that I can load a JComboBox with a
Vector of Objects. I then assumed that it would react
to these objects in a similiar fashion to a swing
combobox and use the .toString() method to render the
object in the JComboBox .draw() method.

However, I was getting ClassCastExceptions when I did
this so then started to browse around the Charva
source to see if my assumption was correct or not.

I then located the following line in the .draw()
method

String selectedItem = (String) _model.getSelectedItem
();

Since this type casts to a String class I then went
searching to see if any of the methods that populated
the _model instance use a .toString() but they didn't
seem to unless I have missed something. Of course
that is entirely possible but I thought I'd ask
anyway.

Kind Regards, Bruce

Discussion


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks