Class GComboBoxCellRenderer<E>

Type Parameters:
E - the element-type this list models.
All Implemented Interfaces:
GComponent, ImageObserver, MenuContainer, PropertyChangeListener, Serializable, EventListener, Accessible, ListCellRenderer<E>, SwingConstants

public class GComboBoxCellRenderer<E> extends GListCellRenderer<E>
Provides a common implementation of a combo box drop-down list renderer, for use with JComboBoxes.

HTML rendering defaults to disabled. See GComponent.setHTMLRenderingEnabled(boolean).

See Also:
  • Constructor Details

    • GComboBoxCellRenderer

      public GComboBoxCellRenderer()
  • Method Details

    • createDefaultTextRenderer

      public static <E> GComboBoxCellRenderer<E> createDefaultTextRenderer(Function<E,String> cellToTextMappingFunction)
      Returns a new GComboBoxCellRenderer that maps the list's data instance to a string used in the cell.

      Use this if you only need to provide a way to get the string value from the type being shown in the list.

      Parameters:
      cellToTextMappingFunction - a function that maps your custom type to a string value
      Returns:
      new GComboBoxCellRenderer instance
    • getDefaultBackgroundColor

      protected Color getDefaultBackgroundColor()
      Overrides:
      getDefaultBackgroundColor in class GListCellRenderer<E>
    • checkForInvalidSetFont

      protected void checkForInvalidSetFont(Font f)
      Overrides:
      checkForInvalidSetFont in class AbstractGCellRenderer