Java 8 DefaultListCellRenderer - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 DefaultListCellRenderer class.

This code example shows how to use the following methods:putClientProperty
  public GenericCellRenderer() 
  { 
    tableCellRenderer = new DefaultTableCellRenderer();
    tableCellRenderer.putClientProperty("html.disable", Boolean.TRUE);
 
    listCellRenderer = new DefaultListCellRenderer();
    listCellRenderer.putClientProperty("html.disable", Boolean.TRUE);
  } 
 
  /** 
   * Returns the component used for drawing the cell.  This method is 
   * used to configure the renderer appropriately before drawing. 
   * 
   * @param  table    the <code>JTable</code> that is asking the 
   * renderer to draw; can be <code>null</code> 
   * @param  value    the value of the cell to be rendered.  It is 
   * up to the specific renderer to interpret 
   * and draw the value.  For example, if 
   * <code>value</code> 
   * is the string "true", it could be rendered as a 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:putClientProperty
  public FormulaFragmentCellRenderer() 
  { 
    tableCellRenderer = new DefaultTableCellRenderer();
    tableCellRenderer.putClientProperty("html.disable", Boolean.TRUE); // NON-NLS
 
    listCellRenderer = new DefaultListCellRenderer();
    listCellRenderer.putClientProperty("html.disable", Boolean.TRUE); // NON-NLS
  } 
 
  public Component getTableCellRendererComponent(final JTable table,
                                                 final Object value, 
                                                 final boolean isSelected,
                                                 final boolean hasFocus,
                                                 final int row,
                                                 final int column)
  { 
    if (value == null) 
    { 
      return tableCellRenderer.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
    } 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:putClientProperty
  public FormulaFragmentCellRenderer() 
  { 
    tableCellRenderer = new DefaultTableCellRenderer();
    tableCellRenderer.putClientProperty("html.disable", Boolean.TRUE); // NON-NLS
 
    listCellRenderer = new DefaultListCellRenderer();
    listCellRenderer.putClientProperty("html.disable", Boolean.TRUE); // NON-NLS
  } 
 
  public Component getTableCellRendererComponent(final JTable table,
                                                 final Object value, 
                                                 final boolean isSelected,
                                                 final boolean hasFocus,
                                                 final int row,
                                                 final int column)
  { 
    if (value == null) 
    { 
      return tableCellRenderer.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
    } 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
	 * renderer for a specific language. 
	 * 
	 * @return The default renderer for the completion list. 
	 */ 
	protected ListCellRenderer createDefaultCompletionCellRenderer() {
		return new DefaultListCellRenderer();
	} 
 
 
	/** 
	 * Attempts to delegate rendering to a Substance cell renderer. 
	 * 
	 * @param ccr The cell renderer to modify. 
	 */ 
	private void delegateToSubstanceRenderer(CompletionCellRenderer ccr) {
		try { 
			ccr.delegateToSubstanceRenderer();
		} catch (Exception e) {
			// Never happens if Substance is on the classpath. 
			e.printStackTrace();
3
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
	private final JPanel colorComponent;
	private JPanel darkerColorComponent;
//	private JPanel darkestColorComponent; 
	private JPanel colorContainer;
	 
	private DefaultListCellRenderer delegate = new DefaultListCellRenderer();
 
	public ColorListCellRenderer() { 
		container = new JPanel(new GridBagLayout());
 
		GridBagConstraints itemConstraint = new GridBagConstraints();
		itemConstraint.insets = new Insets(1, 1, 1, 1);
 
 
		{ 
			colorContainer = new JPanel(new GridBagLayout());
 
			{ 
				colorComponent = new JPanel();
				colorComponent.setPreferredSize(new Dimension(50, 20));
3
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
 * @author Nils Woehler 
 * 
 */ 
public class ColorRGBComboBoxCellRenderer implements ListCellRenderer {
 
	private final DefaultListCellRenderer defaultRenderer = new DefaultListCellRenderer();
 
	private final Border focusBorder = BorderFactory.createLineBorder(Color.gray, 2);
	private final Border noFocusBorder = BorderFactory.createEmptyBorder(2, 2, 2, 2);
	 
	private Map<Color, Icon> colorMap = new HashMap<Color, Icon>();
 
	@Override 
	public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
		JLabel listCellRendererComponent = (JLabel) defaultRenderer.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
 
		listCellRendererComponent.setPreferredSize(new Dimension(50, 20));
 
		if (!(value instanceof Color)) {
			return listCellRendererComponent;
3
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getListCellRendererComponent
     * @param cellHasFocus Specifies if the item has focus or not 
     */ 
    @Override 
    public Component getListCellRendererComponent(JList list, Object value,
            int index, boolean isSelected, boolean cellHasFocus) {
        JLabel label = (JLabel) defaultRenderer.getListCellRendererComponent(
                list, value, index, isSelected, cellHasFocus);
        if (value instanceof BugType) { 
            BugType type = (BugType) value;
            String iconPath = "bugs/normal/open_" + type.getKey() + ".png";
            String text = type.getValue();
            ImageIcon icon = ImageProvider.get(iconPath);
            label.setIcon(icon);
            label.setText(text);
            label.setFont( new Font("Times New Roman", Font.BOLD, 12));
        } 
        return label;
    } 
 
} 
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
	} 
 
	public static ListCellRenderer getIconRenderer() {
		if(listCellRenderer == null)
			listCellRenderer = new ListCellRenderer() {
			private ListCellRenderer delegate = new DefaultListCellRenderer();
			public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected,
			                                              boolean cellHasFocus) {
				final Object renderedValue; 
				if(value instanceof NamedObject){ 
					final Icon icon = ((NamedObject)value).getIcon();
					if(icon != null)
						renderedValue = icon;
					else 
						renderedValue = value; 
				} 
				else 
					renderedValue = value; 
				return delegate.getListCellRendererComponent(list, renderedValue, index, isSelected, cellHasFocus);
			} 
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
public class EnumComboBoxCellRenderer implements ListCellRenderer {
 
	private final String i18nKeyPrefix;
	private final Map<Object,String> textCache = new HashMap<Object, String>();
	private final Map<Object,ImageIcon> iconCache = new HashMap<Object, ImageIcon>();
	private final DefaultListCellRenderer defaultRenderer = new DefaultListCellRenderer();
	 
	/** 
	 *	Creates a Enumeration ComboBox cell renderer. 
	 *  
	 * @param key the gui resource key.   
	 * Example: gui.label.foo_plotter.series_type.LINES.label with key 'foo_plotter.series_type' 
	 */ 
	public EnumComboBoxCellRenderer(String key) {
		this.i18nKeyPrefix = key;
	} 
	 
	@Override 
	public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
		JLabel listCellRendererComponent = (JLabel) defaultRenderer.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
3
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
    private DefaultNameFormatter formatter = DefaultNameFormatter.getInstance();
 
    /** 
     * Default list cell renderer - delegate for ListCellRenderer operation 
     */ 
    private DefaultListCellRenderer defaultListCellRenderer = new DefaultListCellRenderer();
 
    /** 
     * Default table cell renderer - delegate for TableCellRenderer operation 
     */ 
    private DefaultTableCellRenderer defaultTableCellRenderer = new DefaultTableCellRenderer();
 
    /** 
     * Adapter method supporting the ListCellRenderer interface. 
     */ 
    @Override 
    public Component getListCellRendererComponent(JList<? extends OsmPrimitive> list, OsmPrimitive value, int index, boolean isSelected, boolean cellHasFocus) {
        Component def = defaultListCellRenderer.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
        return renderer(def, value);
    } 
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
See Code Examples for Java 8 DefaultListCellRenderer Methods: