1 42 43 package org.jfree.chart.editor; 44 45 import java.awt.BorderLayout ; 46 47 import javax.swing.JComboBox ; 48 import javax.swing.JPanel ; 49 50 import org.jfree.chart.plot.ColorPalette; 51 import org.jfree.chart.plot.RainbowPalette; 52 53 58 class PaletteChooserPanel extends JPanel { 59 60 61 private JComboBox selector; 62 63 69 public PaletteChooserPanel(PaletteSample current, 70 PaletteSample[] available) { 71 setLayout(new BorderLayout ()); 72 this.selector = new JComboBox (available); 73 this.selector.setSelectedItem(current); 74 this.selector.setRenderer(new PaletteSample(new RainbowPalette())); 75 add(this.selector); 76 } 77 78 83 public ColorPalette getSelectedPalette() { 84 PaletteSample sample = (PaletteSample) this.selector.getSelectedItem(); 85 return sample.getPalette(); 86 } 87 } 88 | Popular Tags |