Example usage for java.awt Color lightGray

List of usage examples for java.awt Color lightGray

Introduction

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

Prototype

Color lightGray

To view the source code for java.awt Color lightGray.

Click Source Link

Document

The color light gray.

Usage

From source file:Main.java

public Main() {
    StringBuilder sb = new StringBuilder();
    sb.append("<html><body>");
    sb.append("1");
    sb.append("<sup>");
    sb.append("2");
    sb.append("</sup>");
    sb.append("<font size=+1>/<font size=-1>");
    sb.append("<sub>");
    sb.append("3");
    sb.append("</sub>");
    sb.append("</html></body>");
    JLabel label = new JLabel(sb.toString(), JLabel.CENTER);
    label.setBorder(BorderFactory.createLineBorder(Color.lightGray));
    add(label);//from   w  w w  .  j  a v  a 2 s .co m
}

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

private static JFreeChart createChart(VectorXYDataset dataset) {
    NumberAxis xAxis = new NumberAxis("X");
    xAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    xAxis.setLowerMargin(0.01D);//w  w w .j  av a  2s  .  co m
    xAxis.setUpperMargin(0.01D);
    xAxis.setAutoRangeIncludesZero(false);
    NumberAxis yAxis = new NumberAxis("Y");
    yAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    yAxis.setLowerMargin(0.01D);
    yAxis.setUpperMargin(0.01D);
    yAxis.setAutoRangeIncludesZero(false);
    //
    VectorRenderer renderer = new VectorRenderer();
    renderer.setSeriesPaint(0, Color.blue);
    XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);
    plot.setAxisOffset(new RectangleInsets(5D, 5D, 5D, 5D));
    plot.setOutlinePaint(Color.black);
    JFreeChart chart = new JFreeChart("Vector Plot Demo 1", plot);
    chart.setBackgroundPaint(Color.white);
    return chart;
}

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

private static JFreeChart createChart(VectorXYDataset dataset) {
    NumberAxis xAxis = new NumberAxis("X");
    xAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    xAxis.setLowerMargin(0.01D);/*from   ww  w.  j  av  a2s.co m*/
    xAxis.setUpperMargin(0.01D);
    xAxis.setAutoRangeIncludesZero(false);
    NumberAxis yAxis = new NumberAxis("Y");
    yAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    yAxis.setLowerMargin(0.01D);
    yAxis.setUpperMargin(0.01D);
    yAxis.setAutoRangeIncludesZero(false);
    //
    VectorRenderer renderer = new VectorRenderer();
    renderer.setSeriesPaint(0, Color.blue);
    XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);
    plot.setAxisOffset(new RectangleInsets(5D, 5D, 5D, 5D));
    plot.setOutlinePaint(Color.black);
    JFreeChart chart = new JFreeChart("Vector Renderer Demo 1", plot);
    chart.setBackgroundPaint(Color.white);
    return chart;
}

From source file:Test.java

public Test() {
    this.setBounds(100, 100, 200, 100);
    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JPanel panel = new JPanel();
    panel.setBorder(BorderFactory.createSoftBevelBorder(BevelBorder.LOWERED, Color.lightGray, Color.yellow));
    //panel.setBorder(BorderFactory.createSoftBevelBorder(BevelBorder.RAISED, 
    //  Color.lightGray, Color.yellow));
    //panel.setBorder(BorderFactory.createSoftBevelBorder(BevelBorder.LOWERED, 
    //  Color.lightGray, Color.lightGray, Color.white, Color.orange));

    this.setLayout(new FlowLayout());

    JButton exitButton = new JButton("Exit");
    panel.add(exitButton);//from   w  w  w  .ja  v a  2 s. c  om
    this.add(panel);

    exitButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent event) {
            System.exit(0);
        }
    });
}

From source file:TexturePaintDemo.java

public void paint(Graphics g) {
    Graphics2D g2 = (Graphics2D) g;
    BufferedImage bi = new BufferedImage(5, 5, BufferedImage.TYPE_INT_RGB);
    Graphics2D big = bi.createGraphics();
    big.setColor(Color.blue);// www .jav  a2 s .  c om
    big.fillRect(0, 0, 5, 5);
    big.setColor(Color.lightGray);
    big.fillOval(0, 0, 5, 5);
    Rectangle r = new Rectangle(0, 0, 5, 5);
    g2.setPaint(new TexturePaint(bi, r));

    Rectangle rect = new Rectangle(5, 5, 200, 200);

    g2.fill(rect);
}

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

private static JFreeChart createChart() {
    XYDataset xydataset = createDataset("March 2007", 100D, new Day(1, 3, 2007), 31);
    JFreeChart jfreechart = ChartFactory.createTimeSeriesChart("Multiple Axis Demo 4", "Date", "Value",
            xydataset, true, true, false);
    jfreechart.setBackgroundPaint(Color.white);
    XYPlot xyplot = (XYPlot) jfreechart.getPlot();
    xyplot.setOrientation(PlotOrientation.VERTICAL);
    xyplot.setBackgroundPaint(Color.lightGray);
    xyplot.setDomainGridlinePaint(Color.white);
    xyplot.setRangeGridlinePaint(Color.white);
    xyplot.setAxisOffset(new RectangleInsets(5D, 5D, 5D, 5D));
    DateAxis dateaxis = (DateAxis) xyplot.getDomainAxis();
    dateaxis.setDateFormatOverride(new SimpleDateFormat("d-MMM-yyyy"));
    XYItemRenderer xyitemrenderer = xyplot.getRenderer();
    xyitemrenderer.setSeriesPaint(0, Color.red);
    NumberAxis numberaxis = (NumberAxis) xyplot.getRangeAxis();
    numberaxis.setTickLabelPaint(Color.red);
    DateAxis dateaxis1 = new DateAxis("Date");
    dateaxis1.setDateFormatOverride(new SimpleDateFormat("d-MMM-yyyy"));
    xyplot.setDomainAxis(1, dateaxis1);/*from w  ww  .  j a  va 2  s .c o m*/
    xyplot.setDomainAxisLocation(1, AxisLocation.TOP_OR_LEFT);
    NumberAxis numberaxis1 = new NumberAxis("Value");
    numberaxis1.setAutoRangeIncludesZero(false);
    numberaxis1.setTickLabelPaint(Color.blue);
    xyplot.setRangeAxis(1, numberaxis1);
    xyplot.setRangeAxisLocation(1, AxisLocation.BOTTOM_OR_RIGHT);
    XYDataset xydataset1 = createDataset("July 2007", 1000D, new Day(1, 7, 2007), 31);
    xyplot.setDataset(1, xydataset1);
    xyplot.mapDatasetToDomainAxis(1, 1);
    xyplot.mapDatasetToRangeAxis(1, 1);
    XYLineAndShapeRenderer xylineandshaperenderer = new XYLineAndShapeRenderer(true, false);
    xylineandshaperenderer.setSeriesPaint(0, Color.blue);
    xyplot.setRenderer(1, xylineandshaperenderer);
    return jfreechart;
}

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

private static JFreeChart createChart(IntervalXYDataset intervalxydataset) {
    DateAxis dateaxis = new DateAxis("Date");
    NumberAxis numberaxis = new NumberAxis("Y");
    XYBarRenderer xybarrenderer = new XYBarRenderer();
    xybarrenderer.setUseYInterval(true);
    XYPlot xyplot = new XYPlot(intervalxydataset, dateaxis, numberaxis, xybarrenderer);
    JFreeChart jfreechart = new JFreeChart(xyplot);
    jfreechart.setBackgroundPaint(Color.white);
    xyplot.setBackgroundPaint(Color.lightGray);
    xyplot.setDomainGridlinePaint(Color.white);
    xyplot.setDomainGridlinesVisible(true);
    xyplot.setRangeGridlinePaint(Color.white);
    return jfreechart;
}

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

private static JFreeChart createChart() {
    XYDataset xydataset = createDataset(1, 1.0D);
    JFreeChart jfreechart = ChartFactory.createXYLineChart("XYLineAndShapeRenderer Demo 2", "X", "Y", xydataset,
            PlotOrientation.VERTICAL, true, true, false);
    jfreechart.setBackgroundPaint(Color.white);
    TextTitle texttitle = new TextTitle(
            "This chart shows various combinations of the useFillPaint and useOutlinePaint flags.");
    texttitle.setFont(new Font("Dialog", 0, 10));
    jfreechart.addSubtitle(texttitle);/*from  w ww .j  a va  2 s  .c  om*/
    XYPlot xyplot = (XYPlot) jfreechart.getPlot();
    xyplot.setBackgroundPaint(Color.lightGray);
    xyplot.setDomainGridlinePaint(Color.white);
    xyplot.setRangeGridlinePaint(Color.white);
    NumberAxis numberaxis = (NumberAxis) xyplot.getRangeAxis();
    numberaxis.setAutoRangeIncludesZero(false);
    java.awt.geom.Ellipse2D.Double double1 = new java.awt.geom.Ellipse2D.Double(-4D, -4D, 8D, 8D);
    XYLineAndShapeRenderer xylineandshaperenderer = (XYLineAndShapeRenderer) xyplot.getRenderer();
    xylineandshaperenderer.setBaseShapesVisible(true);
    xylineandshaperenderer.setSeriesShape(0, double1);
    xylineandshaperenderer.setSeriesPaint(0, Color.red);
    xylineandshaperenderer.setSeriesFillPaint(0, Color.yellow);
    xylineandshaperenderer.setSeriesOutlinePaint(0, Color.gray);
    XYDataset xydataset1 = createDataset(2, 2D);
    XYLineAndShapeRenderer xylineandshaperenderer1 = new XYLineAndShapeRenderer();
    xyplot.setDataset(1, xydataset1);
    xyplot.setRenderer(1, xylineandshaperenderer1);
    xylineandshaperenderer1.setSeriesShape(0, double1);
    xylineandshaperenderer1.setSeriesPaint(0, Color.red);
    xylineandshaperenderer1.setSeriesFillPaint(0, Color.yellow);
    xylineandshaperenderer1.setSeriesOutlinePaint(0, Color.gray);
    xylineandshaperenderer1.setUseFillPaint(true);
    XYDataset xydataset2 = createDataset(3, 3D);
    XYLineAndShapeRenderer xylineandshaperenderer2 = new XYLineAndShapeRenderer();
    xyplot.setDataset(2, xydataset2);
    xyplot.setRenderer(2, xylineandshaperenderer2);
    xylineandshaperenderer2.setSeriesShape(0, double1);
    xylineandshaperenderer2.setSeriesPaint(0, Color.red);
    xylineandshaperenderer2.setSeriesFillPaint(0, Color.yellow);
    xylineandshaperenderer2.setSeriesOutlinePaint(0, Color.gray);
    xylineandshaperenderer2.setUseOutlinePaint(true);
    XYDataset xydataset3 = createDataset(4, 4D);
    XYLineAndShapeRenderer xylineandshaperenderer3 = new XYLineAndShapeRenderer();
    xyplot.setDataset(3, xydataset3);
    xyplot.setRenderer(3, xylineandshaperenderer3);
    xylineandshaperenderer3.setSeriesShape(0, double1);
    xylineandshaperenderer3.setSeriesPaint(0, Color.red);
    xylineandshaperenderer3.setSeriesFillPaint(0, Color.yellow);
    xylineandshaperenderer3.setSeriesOutlinePaint(0, Color.gray);
    xylineandshaperenderer3.setUseOutlinePaint(true);
    xylineandshaperenderer3.setUseFillPaint(true);
    XYDataset xydataset4 = createDataset(5, 5D);
    XYLineAndShapeRenderer xylineandshaperenderer4 = new XYLineAndShapeRenderer();
    xyplot.setDataset(4, xydataset4);
    xyplot.setRenderer(4, xylineandshaperenderer4);
    xylineandshaperenderer4.setSeriesShape(0, double1);
    xylineandshaperenderer4.setSeriesPaint(0, Color.red);
    xylineandshaperenderer4.setSeriesFillPaint(0, Color.yellow);
    xylineandshaperenderer4.setSeriesOutlinePaint(0, Color.gray);
    xylineandshaperenderer4.setUseOutlinePaint(true);
    xylineandshaperenderer4.setUseFillPaint(true);
    xylineandshaperenderer4.setDrawOutlines(false);
    return jfreechart;
}

From source file:com.imaging100x.tracker.TrackerUtils.java

/**
* Create a frame with a plot of the data given in XYSeries
*///w  w w . jav a 2s.  c  o m
public static void plotData(String title, final XYSeries data, String xTitle, String yTitle, int xLocation,
        int yLocation) {
    // JFreeChart code
    XYSeriesCollection dataset = new XYSeriesCollection();
    dataset.addSeries(data);
    JFreeChart chart = ChartFactory.createScatterPlot(title, // Title
            xTitle, // x-axis Label
            yTitle, // y-axis Label
            dataset, // Dataset
            PlotOrientation.VERTICAL, // Plot Orientation
            false, // Show Legend
            true, // Use tooltips
            false // Configure chart to generate URLs?
    );
    final XYPlot plot = (XYPlot) chart.getPlot();
    plot.setBackgroundPaint(Color.white);
    plot.setRangeGridlinePaint(Color.lightGray);
    XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer();
    renderer.setBaseShapesVisible(true);
    renderer.setSeriesPaint(0, Color.black);
    renderer.setSeriesFillPaint(0, Color.white);
    renderer.setSeriesLinesVisible(0, true);
    Shape circle = new Ellipse2D.Float(-2.0f, -2.0f, 4.0f, 4.0f);
    renderer.setSeriesShape(0, circle, false);
    renderer.setUseFillPaint(true);

    ChartFrame graphFrame = new ChartFrame(title, chart);
    graphFrame.getChartPanel().setMouseWheelEnabled(true);
    graphFrame.setPreferredSize(new Dimension(SIZE, SIZE));
    graphFrame.setResizable(true);
    graphFrame.pack();
    graphFrame.setLocation(xLocation, yLocation);
    graphFrame.setVisible(true);

    dataset.addChangeListener(new DatasetChangeListener() {

        public void datasetChanged(DatasetChangeEvent dce) {
            double xRange = data.getMaxX() - data.getMinX();
            double yRange = data.getMaxY() - data.getMinY();
            double xAvg = (data.getMaxX() + data.getMinX()) / 2;
            double yAvg = (data.getMaxY() + data.getMinY()) / 2;
            double range = xRange;
            if (yRange > range) {
                range = yRange;
            }
            double offset = 0.55 * range;
            plot.getDomainAxis().setRange(xAvg - offset, xAvg + offset);
            plot.getRangeAxis().setRange(yAvg - offset, yAvg + offset);
        }

    });

}

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

private static JFreeChart createChart(XYDataset xydataset) {
    JFreeChart jfreechart = ChartFactory.createTimeSeriesChart("Legal & General Unit Trust Prices", "Date",
            "Price Per Unit", xydataset, true, true, false);
    jfreechart.setBackgroundPaint(Color.white);
    XYPlot xyplot = (XYPlot) jfreechart.getPlot();
    xyplot.setBackgroundPaint(Color.lightGray);
    xyplot.setDomainGridlinePaint(Color.white);
    xyplot.setRangeGridlinePaint(Color.white);
    xyplot.setAxisOffset(new RectangleInsets(5D, 5D, 5D, 5D));
    xyplot.setDomainCrosshairVisible(true);
    xyplot.setRangeCrosshairVisible(true);
    org.jfree.chart.renderer.xy.XYItemRenderer xyitemrenderer = xyplot.getRenderer();
    if (xyitemrenderer instanceof XYLineAndShapeRenderer) {
        XYLineAndShapeRenderer xylineandshaperenderer = (XYLineAndShapeRenderer) xyitemrenderer;
        xylineandshaperenderer.setBaseShapesVisible(true);
        xylineandshaperenderer.setBaseShapesFilled(true);
        xylineandshaperenderer.setBaseItemLabelsVisible(true);
    }/*from  w  w  w .  j a  va  2 s . c  o m*/
    PeriodAxis periodaxis = new PeriodAxis("Date");
    periodaxis.setTimeZone(TimeZone.getTimeZone("Pacific/Auckland"));
    periodaxis.setAutoRangeTimePeriodClass(org.jfree.data.time.Day.class);
    PeriodAxisLabelInfo aperiodaxislabelinfo[] = new PeriodAxisLabelInfo[3];
    aperiodaxislabelinfo[0] = new PeriodAxisLabelInfo(org.jfree.data.time.Day.class, new SimpleDateFormat("d"));
    aperiodaxislabelinfo[1] = new PeriodAxisLabelInfo(org.jfree.data.time.Month.class,
            new SimpleDateFormat("MMM"), new RectangleInsets(2D, 2D, 2D, 2D), new Font("SansSerif", 1, 10),
            Color.blue, false, new BasicStroke(0.0F), Color.lightGray);
    aperiodaxislabelinfo[2] = new PeriodAxisLabelInfo(org.jfree.data.time.Year.class,
            new SimpleDateFormat("yyyy"));
    periodaxis.setLabelInfo(aperiodaxislabelinfo);
    xyplot.setDomainAxis(periodaxis);
    return jfreechart;
}