1 41 42 package org.jfree.chart.ui; 43 44 import java.awt.BorderLayout ; 45 46 import javax.swing.JComboBox ; 47 import javax.swing.JPanel ; 48 49 54 public class PaletteChooserPanel extends JPanel { 55 56 57 private JComboBox selector; 58 59 65 public PaletteChooserPanel(PaletteSample current, 66 PaletteSample[] available) { 67 setLayout(new BorderLayout ()); 68 this.selector = new JComboBox (available); 69 this.selector.setSelectedItem(current); 70 this.selector.setRenderer(new PaletteSample(new RainbowPalette())); 71 add(this.selector); 72 } 73 74 79 public ColorPalette getSelectedPalette() { 80 PaletteSample sample = (PaletteSample) this.selector.getSelectedItem(); 81 return sample.getPalette(); 82 } 83 } 84 | Popular Tags |