Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* $Id: DefaultListRenderer.java 3779 2010-09-07 18:01:55Z kschaefe $
*
* Copyright 2006 Sun Microsystems, Inc., 4150 Network Circle,
* Santa Clara, California 95054, U.S.A. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
package org.jdesktop.swingx.renderer;
import javax.swing.JList;
import javax.swing.ListCellRenderer;
import java.awt.Component;
/**
* Adapter to glue SwingX renderer support to core API. It has convenience
* constructors to create a LabelProvider, optionally configured with a
* StringValue and horizontal alignment. Typically, client code does not
* interact with this class except at instantiation time.
*
*
* Note: core DefaultListCellRenderer shows either an icon or the element's
* toString representation, depending on whether or not the given value
* is of type icon or implementors. This renderer's empty/null provider
* constructor takes care of configuring the default provider with a converter
* which mimics that behaviour. When instantiating this renderer with
* any of the constructors which have converters as parameters,
* it's up to the client code to supply the appropriate converter, if needed:
*
*
*
* StringValue sv = new StringValue() {
*
* public String getString(Object value) {
* if (value instanceof Icon) {
* return "";
* }
* return StringValue.TO_STRING.getString(value);
* }
*
* };
* StringValue lv = new MappedValue(sv, IconValue.ICON);
* listRenderer = new DefaultListRenderer(lv, alignment);
*
*