Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

using a JComboBox as a cell renderer in a JXTreeTable



Hey all,

i'd like using a JComboBox as a cell renderer in a JXTreeTable.

i'm able to get the combo at the right place but the list items doesn't popup.

here is the piece of code :

<code>
public class SoilsRenderer extends DefaultTableCellRenderer {

    public SoilsRenderer() {}

public Component getTableCellRendererComponent(JTable table, Object value,
boolean isSelected, boolean hasFocus, int row, int column) {
super.getTableCellRendererComponent(table, value, isSelected, hasFocus,
row, column);
if (value != null) {
ArrayList<Soil> soils = (ArrayList<Soil>) value;
ArrayList<String> sols = new ArrayList<String>();
for (int i = 0; i < soils.size(); i++) {
sols.add(((Soil) soils.get(i)).getType());
}
return new JComboBox(sols.toArray());
} else {
return new JLabel();
}
}
}
</code>


from print out i'm sure their is more than one item in the combo.

if i use the same combo as an editor, i get the popup, but here, i don't want to edit just to show multiple values...

also i use the same way to set an icon, no prob.

best,

Yvon


_______________________________________________ Do not post admin requests to the list. They will be ignored. Java-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.