1 17 package org.columba.core.gui.config; 18 19 import java.awt.Component ; 20 21 import javax.swing.DefaultListCellRenderer ; 22 import javax.swing.JLabel ; 23 import javax.swing.JList ; 24 25 import org.columba.api.plugin.IExtensionHandler; 26 import org.columba.api.plugin.IExtensionHandlerKeys; 27 import org.columba.api.plugin.PluginHandlerNotFoundException; 28 import org.columba.core.gui.dialog.ErrorDialog; 29 import org.columba.core.plugin.PluginManager; 30 31 34 public class ThemeComboBoxRenderer extends DefaultListCellRenderer { 35 protected IExtensionHandler pluginHandler; 36 37 public ThemeComboBoxRenderer() { 38 super(); 39 40 try { 41 pluginHandler = PluginManager.getInstance() 42 .getExtensionHandler(IExtensionHandlerKeys.ORG_COLUMBA_CORE_THEME); 43 } catch (PluginHandlerNotFoundException ex) { 44 ErrorDialog.createDialog(ex.getMessage(), ex); 45 } 46 } 47 48 54 public Component getListCellRendererComponent(JList list, Object value, 55 int index, boolean isSelected, boolean cellHasFocus) { 56 57 JLabel label = (JLabel ) super.getListCellRendererComponent(list, value, 58 index, isSelected, cellHasFocus); 59 String id = (String ) value; 61 String userVisibleName = id; 63 label.setText(userVisibleName); 64 return label; 65 } 66 } 67 | Popular Tags |