Example usage for java.awt Color Color

List of usage examples for java.awt Color Color

Introduction

In this page you can find the example usage for java.awt Color Color.

Prototype

public Color(ColorSpace cspace, float[] components, float alpha) 

Source Link

Document

Creates a color in the specified ColorSpace with the color components specified in the float array and the specified alpha.

Usage

From source file:org.gvsig.gui.beans.graphic.GraphicChartPanel.java

public GraphicChartPanel() {
    dataset = new XYSeriesCollection();

    createChart();/*from   ww w .  jav  a 2s.co m*/

    initialize();

    Plot plot = this.jPanelChart.getChart().getPlot();
    plot.setOutlineStroke(new BasicStroke(1));
    plot.setOutlinePaint(Color.black);

    chart.setBackgroundPaint(Color.white);
    plot.setBackgroundPaint(new Color(245, 245, 245));
}

From source file:com.cmsoftware.keyron.vista.Login.java

/**
 * Funcin que valida campos e inicia sesin.
 *///from www  .jav  a  2s. c om
private void iniciarSesion() {
    if (usuario.getText().trim().isEmpty() || usuario.getText().trim().length() < 5) {
        labelError.setText(Configuracion.getInstancia().getBundle().getString("usuario_novalido"));
        usuario.requestFocus();
        usuario.setBackground(new Color(253, 194, 194));
    } else if (clave.getPassword().length != 0) {
        usuario.setEnabled(false);
        clave.setEnabled(false);
        acceder.setEnabled(false);
        labelError.setText(Configuracion.getInstancia().getBundle().getString("ingresando"));
        labelError.setIcon(new javax.swing.ImageIcon(
                getClass().getResource("/com/cmsoftware/keyron/recursos/cargando.gif")));
        new Acceso().start();
    } else {
        labelError.setText(Configuracion.getInstancia().getBundle().getString("clave_novalido"));
        clave.requestFocus();
        clave.setBackground(new Color(253, 194, 194));
    }
}

From source file:userInterface.cdcRole.OverviewJPanel.java

private static JFreeChart createChart1(CategoryDataset categorydataset) {
    JFreeChart jfreechart = ChartFactory.createBarChart("Distribution of Vaccines", "Vaccine", "Quantity",
            categorydataset, PlotOrientation.VERTICAL, true, true, false);
    CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot();
    categoryplot.setDomainGridlinesVisible(true);
    categoryplot.setRangeCrosshairVisible(true);
    categoryplot.setRangeCrosshairPaint(Color.green);
    NumberAxis numberaxis = (NumberAxis) categoryplot.getRangeAxis();
    numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    BarRenderer barrenderer = (BarRenderer) categoryplot.getRenderer();
    barrenderer.setDrawBarOutline(false);
    GradientPaint gradientpaint = new GradientPaint(0.0F, 0.0F, Color.green, 0.0F, 0.0F, new Color(0, 0, 64));
    GradientPaint gradientpaint1 = new GradientPaint(0.0F, 0.0F, Color.green, 0.0F, 0.0F, new Color(0, 64, 0));
    GradientPaint gradientpaint2 = new GradientPaint(0.0F, 0.0F, Color.red, 0.0F, 0.0F, new Color(64, 0, 0));
    barrenderer.setSeriesPaint(0, gradientpaint);
    barrenderer.setSeriesPaint(1, gradientpaint1);
    barrenderer.setSeriesPaint(2, gradientpaint2);
    barrenderer.setLegendItemToolTipGenerator(new StandardCategorySeriesLabelGenerator("Tooltip: {0}"));
    CategoryAxis categoryaxis = categoryplot.getDomainAxis();
    categoryaxis.setCategoryLabelPositions(
            CategoryLabelPositions.createUpRotationLabelPositions(0.52359877559829882D));
    return jfreechart;
}

From source file:FillTest.java

public void paintComponent(Graphics g) {
    Graphics2D g2 = (Graphics2D) g;

    // draw a rectangle

    double leftX = 100;
    double topY = 100;
    double width = 200;
    double height = 150;

    Rectangle2D rect = new Rectangle2D.Double(leftX, topY, width, height);
    g2.setPaint(Color.RED);/*from   ww w.j a v a 2s.c om*/
    g2.fill(rect);

    // draw the enclosed ellipse

    Ellipse2D ellipse = new Ellipse2D.Double();
    ellipse.setFrame(rect);
    g2.setPaint(new Color(0, 128, 128)); // a dull blue-green
    g2.fill(ellipse);
}

From source file:com.rapidminer.gui.plotter.charts.BarChart2DPlotter.java

public JFreeChart createChart(CategoryDataset categoryDataSet, String groupByName, String valueName,
        boolean createLegend) {

    JFreeChart chart = ChartFactory.createBarChart(null, // chart title
            groupByName, // domain axis label
            valueName, // range axis label
            categoryDataSet, // data
            PlotOrientation.VERTICAL, // orientation
            ((createLegend) && (groupByName != null)), // include legend if group by column is set
            true, // tooltips
            false // URLs
    );/* www  .ja va 2  s .  co m*/

    // get a reference to the plot for further customisation...
    CategoryPlot plot = (CategoryPlot) chart.getPlot();
    plot.setBackgroundPaint(new Color(230, 230, 230));
    plot.setDomainGridlinePaint(Color.white);
    plot.setDomainGridlinesVisible(true);
    plot.setRangeGridlinePaint(Color.white);

    // set up paints for series
    if (groupByName == null) {
        BarRenderer renderer = (BarRenderer) plot.getRenderer();
        renderer.setSeriesPaint(0, SwingTools.LIGHT_BLUE);
        renderer.setSeriesPaint(1, SwingTools.LIGHT_YELLOW);
    }

    // domain axis labels
    CategoryAxis domainAxis = plot.getDomainAxis();
    if (groupByName == null) {
        domainAxis.setTickLabelsVisible(true);
        domainAxis.setCategoryLabelPositions(
                CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 6.0));
    } else {
        domainAxis.setTickLabelsVisible(false);
    }

    return chart;
}

From source file:com.rapidminer.gui.plotter.charts.BarChart3DPlotter.java

public JFreeChart createChart(CategoryDataset categoryDataSet, String groupByName, String valueName,
        boolean createLegend) {

    JFreeChart chart = ChartFactory.createBarChart3D(null, // chart title
            groupByName, // domain axis label
            valueName, // range axis label
            categoryDataSet, // data
            PlotOrientation.VERTICAL, // orientation
            ((createLegend) && (groupByName != null)), // include legend if group by column is set
            true, // tooltips
            false // URLs
    );//from w ww .j  a  v  a2 s .c  o  m

    // get a reference to the plot for further customisation...
    CategoryPlot plot = (CategoryPlot) chart.getPlot();
    plot.setBackgroundPaint(new Color(230, 230, 230));
    plot.setDomainGridlinePaint(Color.white);
    plot.setDomainGridlinesVisible(true);
    plot.setRangeGridlinePaint(Color.white);

    // set up paints for series
    if (groupByName == null) {
        BarRenderer renderer = (BarRenderer) plot.getRenderer();
        renderer.setSeriesPaint(0, SwingTools.LIGHT_BLUE);
        renderer.setSeriesPaint(1, SwingTools.LIGHT_YELLOW);
    }

    // domain axis labels
    CategoryAxis domainAxis = plot.getDomainAxis();
    if (groupByName == null) {
        domainAxis.setTickLabelsVisible(true);
        domainAxis.setCategoryLabelPositions(
                CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 6.0));
    } else {
        domainAxis.setTickLabelsVisible(false);
    }

    return chart;
}

From source file:com.safetys.framework.jmesa.view.pdfp.PdfPView.java

public PdfPView() {
    this.evenCellBackgroundColor = new Color(227, 227, 227);
    this.oddCellBackgroundColor = new Color(255, 255, 255);
    this.headerBackgroundColor = new Color(114, 159, 207);
    this.headerFontColor = new Color(255, 255, 255);
    this.captionFontColor = new Color(0, 0, 0);
    this.captionAlignment = "center";
}

From source file:edu.memphis.ccrg.lida.framework.gui.panels.ActivationChartPanel.java

/** Creates new form JChartGuiPanel */
public ActivationChartPanel() {
    chart = ChartFactory.createXYLineChart("", "Tick", "Activation", dataset, PlotOrientation.VERTICAL, true,
            true, false);/* ww w.j  a  v a  2s  .c  om*/
    chart.setBackgroundPaint(new Color(238, 233, 233));
    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setBackgroundPaint(Color.WHITE);
    plot.setDomainGridlinePaint(Color.LIGHT_GRAY);
    plot.setRangeGridlinePaint(Color.LIGHT_GRAY);
    NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis();
    domainAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    initComponents();
}

From source file:org.jfree.chart.demo.ItemLabelDemo5.java

private static JFreeChart createChart(CategoryDataset categorydataset) {
    JFreeChart jfreechart = ChartFactory.createStackedBarChart("Item Label Demo 5", null, null, categorydataset,
            PlotOrientation.VERTICAL, false, true, false);
    jfreechart.setBackgroundPaint(new Color(255, 255, 255));
    CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot();
    MyStackedBarRenderer mystackedbarrenderer = new MyStackedBarRenderer();
    categoryplot.setRenderer(mystackedbarrenderer);
    ItemLabelPosition itemlabelposition = new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.CENTER,
            TextAnchor.CENTER, 0.0D);/* w w  w  .ja  v  a  2s . com*/
    mystackedbarrenderer.setPositiveItemLabelPositionFallback(itemlabelposition);
    mystackedbarrenderer.setNegativeItemLabelPositionFallback(itemlabelposition);
    StandardCategoryItemLabelGenerator standardcategoryitemlabelgenerator = new StandardCategoryItemLabelGenerator(
            "{0}", NumberFormat.getInstance());
    mystackedbarrenderer.setBaseItemLabelGenerator(standardcategoryitemlabelgenerator);
    mystackedbarrenderer.setBaseItemLabelsVisible(true);
    NumberAxis numberaxis = (NumberAxis) categoryplot.getRangeAxis();
    numberaxis.setUpperBound(100D);
    return jfreechart;
}

From source file:chart.DualAxis.java

/**
 * Creates a new demo instance./*from  w  w  w. j  a  v a2 s .c o m*/
 *
 * @param title  the frame title.
 */

public DualAxis(final String title, double[] xData, double[] YDataAnalitic, double[] YDataNumerical) {

    super(title);

    final CategoryDataset dataset1 = createDataset1(xData, YDataAnalitic);

    // create the chart...
    final JFreeChart chart = ChartFactory.createLineChart("", // chart title
            "x", // domain axis label
            "y", // range axis label
            dataset1, // data
            PlotOrientation.VERTICAL, true, // include legend
            true, // tooltips?
            false // URL generator?  Not required...
    );

    // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...
    chart.setBackgroundPaint(Color.white);
    //        chart.getLegend().setAnchor(Legend.SOUTH);

    // get a reference to the plot for further customisation...
    final CategoryPlot plot = chart.getCategoryPlot();
    plot.setBackgroundPaint(new Color(0xEE, 0xEE, 0xFF));
    plot.setDomainAxisLocation(AxisLocation.BOTTOM_OR_RIGHT);

    final CategoryDataset dataset2 = createDataset2(xData, YDataNumerical);
    plot.setDataset(1, dataset2);
    plot.mapDatasetToRangeAxis(1, 1);

    final CategoryAxis domainAxis = plot.getDomainAxis();
    domainAxis.setCategoryLabelPositions(CategoryLabelPositions.DOWN_45);
    //final ValueAxis axis2 = new NumberAxis("");
    final ValueAxis axis2 = new NumberAxis(" ");
    plot.setRangeAxis(1, axis2);

    final LineAndShapeRenderer renderer2 = new LineAndShapeRenderer();
    renderer2.setToolTipGenerator(new StandardCategoryToolTipGenerator());
    plot.setRenderer(1, renderer2);
    plot.setDatasetRenderingOrder(DatasetRenderingOrder.REVERSE);
    // OPTIONAL CUSTOMISATION COMPLETED.

    // add the chart to a panel...
    final ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));
    setContentPane(chartPanel);
    //  panel.removeAll();
    //   panel.add(chartPanel);
    //   panel.validate();

}