| 1 | package be.nikiroo.utils.ui.compat; |
| 2 | |
| 3 | import javax.swing.JList; |
| 4 | import javax.swing.ListCellRenderer; |
| 5 | import javax.swing.ListModel; |
| 6 | |
| 7 | /** |
| 8 | * Compatibility layer so I can at least get rid of the warnings of using |
| 9 | * {@link JList} without a parameter (and still staying Java 1.6 compatible). |
| 10 | * <p> |
| 11 | * This class is merely a {@link JList} that you can parametrise also in Java |
| 12 | * 1.6. |
| 13 | * |
| 14 | * @author niki |
| 15 | * |
| 16 | * @param <E> |
| 17 | * the type to use |
| 18 | */ |
| 19 | @SuppressWarnings({ "unchecked", "rawtypes" }) // not compatible Java 1.6 |
| 20 | public class JList6<E> extends JList { |
| 21 | private static final long serialVersionUID = 1L; |
| 22 | |
| 23 | @Override |
| 24 | @Deprecated |
| 25 | /** |
| 26 | * @deprecated please use {@link JList6#setCellRenderer(ListCellRenderer6)} |
| 27 | * instead |
| 28 | */ |
| 29 | public void setCellRenderer(ListCellRenderer cellRenderer) { |
| 30 | super.setCellRenderer(cellRenderer); |
| 31 | } |
| 32 | |
| 33 | /** |
| 34 | * Sets the delegate that is used to paint each cell in the list. The job of |
| 35 | * a cell renderer is discussed in detail in the <a href="#renderer">class |
| 36 | * level documentation</a>. |
| 37 | * <p> |
| 38 | * If the {@code prototypeCellValue} property is {@code non-null}, setting |
| 39 | * the cell renderer also causes the {@code fixedCellWidth} and |
| 40 | * {@code fixedCellHeight} properties to be re-calculated. Only one |
| 41 | * <code>PropertyChangeEvent</code> is generated however - for the |
| 42 | * <code>cellRenderer</code> property. |
| 43 | * <p> |
| 44 | * The default value of this property is provided by the {@code ListUI} |
| 45 | * delegate, i.e. by the look and feel implementation. |
| 46 | * <p> |
| 47 | * This is a JavaBeans bound property. |
| 48 | * |
| 49 | * @param cellRenderer |
| 50 | * the <code>ListCellRenderer</code> that paints list cells |
| 51 | * @see #getCellRenderer |
| 52 | * @beaninfo bound: true attribute: visualUpdate true description: The |
| 53 | * component used to draw the cells. |
| 54 | */ |
| 55 | public void setCellRenderer(ListCellRenderer6<E> cellRenderer) { |
| 56 | super.setCellRenderer(cellRenderer); |
| 57 | } |
| 58 | |
| 59 | @Override |
| 60 | @Deprecated |
| 61 | public void setModel(ListModel model) { |
| 62 | super.setModel(model); |
| 63 | } |
| 64 | |
| 65 | /** |
| 66 | * Sets the model that represents the contents or "value" of the list, |
| 67 | * notifies property change listeners, and then clears the list's selection. |
| 68 | * <p> |
| 69 | * This is a JavaBeans bound property. |
| 70 | * |
| 71 | * @param model |
| 72 | * the <code>ListModel</code> that provides the list of items for |
| 73 | * display |
| 74 | * @exception IllegalArgumentException |
| 75 | * if <code>model</code> is <code>null</code> |
| 76 | * @see #getModel |
| 77 | * @see #clearSelection |
| 78 | * @beaninfo bound: true attribute: visualUpdate true description: The |
| 79 | * object that contains the data to be drawn by this JList. |
| 80 | */ |
| 81 | public void setModel(ListModel6<E> model) { |
| 82 | super.setModel(model); |
| 83 | } |
| 84 | } |