Nick
Nick

Reputation: 21

How to create a simple look like Combobox in Java for Mac OS

The default Combobox in Mac OS is as follows:

http://dl.dropbox.com/u/10836207/Screen%20shot%202011-08-05%20at%209.53.48%20AM.png

How can I change to following one?:

http://dl.dropbox.com/u/10836207/Screen%20shot%202011-08-05%20at%209.54.01%20AM.png

P.S. - The Combobox is created in JTable.

Upvotes: 1

Views: 949

Answers (2)

trashgod
trashgod

Reputation: 205785

The default UI delegate for JComboBox on Mac OS X is com.apple.laf.AquaComboBoxUI. You can replace it with your own variation of BasicComboBoxUI. There's a related example here and a more complete example in the MacWidgets collection suggested by @Dilum.

Upvotes: 1

Dilum Ranatunga
Dilum Ranatunga

Reputation: 13374

Check out the brilliant MacWidgets

Here are the key steps:

  1. Create a JComboBox with the appropriate L&F.
  2. Create a TableCellEditor with the comboBox, for example using DefaultCellEditor
  3. Set the editor on your JTable using setDefaultEditor(...)

TableCellRenderer getDefaultRenderer(Class columnClass)

Upvotes: 1

Related Questions