/** * Returns a list cell renderer for the stroke, so the sample can be displayed in a list or combo. * * @param list the list component. * @param value the value. * @param index the index. * @param isSelected a flag that indicates whether or not the item is selected. * @param cellHasFocus a flag that indicates whether or not the cell has the focus. * @return The renderer. */ public Component getListCellRendererComponent( JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { if (value instanceof PaletteSample) { PaletteSample in = (PaletteSample) value; setPalette(in.getPalette()); } return this; }
/** * Returns the selected palette. * * @return The selected palette. */ public ColorPalette getSelectedPalette() { PaletteSample sample = (PaletteSample) this.selector.getSelectedItem(); return sample.getPalette(); }