All Downloads are FREE. Search and download functionalities are using the official Maven repository.

editor.tabpane.TabListCellRenderer Maven / Gradle / Ivy

package editor.tabpane;

import javax.swing.*;
import java.awt.*;
import java.beans.BeanInfo;

/**
 */
public class TabListCellRenderer extends DefaultListCellRenderer
{
  public TabListCellRenderer()
  {
  }

  public Component getListCellRendererComponent( JList list,
                                                 Object value,
                                                 int modelIndex,
                                                 boolean isSelected,
                                                 boolean cellHasFocus )
  {
    ITab tab = (ITab)value;
    String text = tab == null ? "" : tab.getLabel().getDisplayName();

    Component renderer = super.getListCellRendererComponent( list, text, modelIndex, isSelected, cellHasFocus );

    if( tab != null )
    {
      setIcon( tab.getLabel().getIcon( BeanInfo.ICON_COLOR_16x16 ) );
    }

    return renderer;
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy