OK, the main problem was that the editable combobox Aqua look sucks
(IMHO) ,so I made:
c.setEditable(true); //as I need a general combobox that
would accept anything to display
c.setSelectedItem(value); //set value, only valid if
editable (or possible values fixed ...)
c.setEditable(false); //non editable
And it is acceptable (for me). And, anyway, my comboboxes are not
editable ...
(Never felt confortable answering to myself, but may be interesting
to others ...)
I was tired of seeing JTable text fields that when you touch them
become anything in Swing ...
Perhaps for more uniformity, you could try something like this:
class TableComboBoxRenderer implements TableCellRenderer {
DefaultCellEditor renderer = new DefaultCellEditor(new JComboBox());
Color co = new Color(180, 180, 255);
Color co2 = new Color(255, 0, 255);
public Component getTableCellRendererComponent(JTable table, Object
value, boolean isSelected, boolean hasFocus, int row, int column) {
JComboBox combo =
(JComboBox)renderer.getTableCellEditorComponent(table, value,
isSelected, row, column);
What this will do is provide you with the same double-headed arrows
that native Cocoa table-cell popups have. Then you can take the
resulting component, and then customize the foreground and background
however you like. This also has the additional benefit of providing a
consistent appearance between the editor and the renderer, and it
looks reasonable in other look and feels besides Aqua.
It's true that the default JComboBox appearance really doesn't belong
inside of table cells, but this is one of those parts of Swing which
is hard to match the native platform with the existing Renderer/Editor
model.
Hope this helps,
Mike Swingler
Java Frameworks Engineer
Apple Inc.
_______________________________________________
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