public static void main(String[] args) { ColorKeyLegend colorKeyPanel = new ColorKeyLegend(GREEN, RED, 0d, 100d); showComponent(colorKeyPanel, "ColorKeyLegend demo"); } }
/** * Shows a {@code JFrame} containing the specified {@code component} and * frame extended {@code state}. * * @param component the {@code Component} to show * @param state the extended state of the frame */ public static final void showComponent(Component component, int state) { showComponent(component, "", state); }
/** * Creates a new {@code ColorLegend} with the specified colors and * orientation. * * @param colors the map of labels and colors. * @param orientation the {@code Orientation} of the legend. */ public ColorLegend(Map<String, Color> colors, Orientation orientation) { this.colors = colors; this.orientation = orientation; this.init(); }
public static void main(String[] args) { ColorLegend colorLegend = new ColorLegend(getColors(), VERTICAL); showComponent( createPanelAndCenterComponent(colorLegend), "ColorLegend demo" ); }
private void init() { this.setMinimumSize(SIZE); this.setPreferredSize(SIZE); this.setSize(SIZE); }
/** * Establishes the high color of the gradient. * * @param color the high color of the gradient */ public void setHighColor(Color color) { this.highColor = color; this.colorKey.setHighColor(color); this.initializeColors(); }
/** * Sets the low color of the gradient. * * @param color the low color of the gradient. */ public void setLowColor(Color color) { this.lowColor = color; this.repaint(); }
private String getLowValue() { return format(this.low); }
/** * Sets the value of the property {@code Nimbus.keepAlternateRowColor} in * {@code UIManager} to {@code true}. * */ public static void setNimbusKeepAlternateRowColor() { setNimbusKeepAlternateRowColor(Boolean.TRUE); }
/** * Sets the decimal format. * * @param decimalFormat the decimal format */ public void setDecimalFormat(DecimalFormat decimalFormat) { this.decimalFormat = decimalFormat; this.colorKey.setDecimalFormat(decimalFormat); }
private boolean isHorizontal() { return this.orientation.equals(Orientation.HORIZONTAL); }
/** * Shows a {@code JFrame} containing the specified {@code component}. * * @param component the {@code Component} to show */ public static final void showComponent(Component component) { showComponent(component, ""); }
/** * Sets the low high of the gradient. * * @param color the high color of the gradient. */ public void setHighColor(Color color) { this.highColor = color; this.repaint(); }
private String getMiddle(){ return format((low + high) / 2); }
public static void main(String[] args) { showComponent( createJOptionPaneMessageDemooComponent(), "JOptionPaneMessage demo"); }
/** * Sets the low value of the gradient. * * @param low the low value of the gradient. */ public void setLowValue(double low) { this.low = low; this.repaint(); }
private String getHighValue() { return format(this.high); }
public static void main(String[] args) { JInputList inputList = new JInputList(); inputList.setElementIntroductionEnabled(true); showComponent(inputList, "JInputList demo"); } }
/** * Sets the high value of the gradient. * * @param high the low value of the gradient. */ public void setHighValue(double high) { this.high = high; this.repaint(); }
/** * Sets the decimal format to format gradient values. * * @param decimalFormat the decimal format to format gradient values. */ public void setDecimalFormat(DecimalFormat decimalFormat) { this.decimalFormat = decimalFormat; this.repaint(); }