Example usage for java.awt Color blue

List of usage examples for java.awt Color blue

Introduction

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

Prototype

Color blue

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

Click Source Link

Document

The color blue.

Usage

From source file:GradientPaintDemo.java

public void paint(Graphics g) {
    Graphics2D g2 = (Graphics2D) g;
    g2.setPaint(new GradientPaint(0, 0, Color.lightGray, 200, 200, Color.blue, false));

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

    g2.fill(r);// w  w w.  j av  a2 s.com
}

From source file:iad_zad3.gui.Charts.java

public static JFreeChart getKmeansChart(final List<double[]> data, final List<double[]> centroids) {
    JFreeChart jfreechart = ChartFactory.createScatterPlot("", "x", "y", createDataset(data, centroids),
            PlotOrientation.VERTICAL, false, false, false);
    XYPlot xyPlot = (XYPlot) jfreechart.getPlot();
    XYItemRenderer renderer = xyPlot.getRenderer();
    renderer.setSeriesShape(1, circleSmall);
    renderer.setSeriesPaint(1, Color.RED);
    renderer.setSeriesShape(0, circleBig);
    renderer.setSeriesPaint(0, Color.BLUE);
    ValueAxis domainAxis = xyPlot.getDomainAxis();
    domainAxis.setRange(DataStats.minVal[0] * 1.2, DataStats.maxVal[0] * 1.2);
    ValueAxis rangeAxis = xyPlot.getRangeAxis();
    rangeAxis.setRange(DataStats.minVal[1] * 1.2, DataStats.maxVal[1] * 1.2);
    jfreechart.setBackgroundPaint(Color.WHITE);
    return jfreechart;
}

From source file:CheckBoxIcon.java

public void paintIcon(Component component, Graphics g, int x, int y) {
    AbstractButton abstractButton = (AbstractButton) component;
    ButtonModel buttonModel = abstractButton.getModel();

    Color color = buttonModel.isSelected() ? Color.BLUE : Color.RED;
    g.setColor(color);//w ww .  ja  v  a 2 s .  c  o m

    g.drawRect(1, 1, 20, 20);

}

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);//from  www. ja  va2s .c om
    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:Main.java

public Main() {
    JPanel parentPanel = new JPanel();
    parentPanel.setLayout(new BorderLayout(10, 10));

    JPanel childPanel1 = new JPanel();
    childPanel1.setBackground(Color.red);
    childPanel1.setPreferredSize(new Dimension(300, 40));

    JPanel childPanel2 = new JPanel();
    childPanel2.setBackground(Color.blue);
    childPanel2.setPreferredSize(new Dimension(800, 600));

    JButton myButton = new JButton("Add Component ");
    myButton.addActionListener(e -> {
        parentPanel.remove(childPanel1);
        parentPanel.add(childPanel2, BorderLayout.CENTER);
        parentPanel.revalidate();//from   w  ww.j a v  a  2s.co m
        parentPanel.repaint();
        pack();
    });
    setLocation(10, 200);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    parentPanel.add(childPanel1, BorderLayout.CENTER);
    parentPanel.add(myButton, BorderLayout.SOUTH);
    add(parentPanel);
    pack();
    setVisible(true);
}

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   www . ja v  a  2 s  . c  o 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:Main.java

public Main() {

    setLayout(new FlowLayout());
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    table = new Hashtable<Integer, Color>();
    table.put(1, Color.RED);/*  w  w w  .java2  s . com*/
    table.put(2, Color.BLUE);
    table.put(3, Color.GREEN);
    table.put(4, Color.GRAY);

    c = new JComboBox<String>();
    c.addItem("Item 1");
    c.addItem("Item 2");
    c.addItem("Item 3");
    c.addItem("Item 4");
    c.addItem("Item 5");
    c.addItem("Item 6");
    c.addItem("Item 7");
    c.addItem("Item 8");

    c.setRenderer(new MyListCellRenderer(table));

    add(c);
    setSize(400, 400);
    setVisible(true);
}

From source file:MainClass.java

public static void pictureCircles(float x, float y, PdfContentByte cb) {
    cb.setColorFill(Color.red);//from  w  w  w .  j  a  v  a 2 s.c om
    cb.circle(x + 70, y + 70, 50);
    cb.fill();
    cb.setColorFill(Color.yellow);
    cb.circle(x + 100, y + 130, 50);
    cb.fill();
    cb.setColorFill(Color.blue);
    cb.circle(x + 130, y + 70, 50);
    cb.fill();
}

From source file:Main.java

public JHyperlinkLabel(String label) {
    super(label);

    setForeground(Color.BLUE.darker());
    setCursor(new Cursor(Cursor.HAND_CURSOR));
    addMouseListener(new HyperlinkLabelMouseAdapter());
}

From source file:AppPackage.HumidityGraph.java

/**
 *
 *//*  w w  w  .  j a  v a2 s .c om*/
public HumidityGraph() {
    try {

        JFrame window = new JFrame();
        window.setSize(1000, 615);
        window.setBackground(Color.blue);

        Dimension dimension = Toolkit.getDefaultToolkit().getScreenSize();
        int x = (int) ((dimension.getWidth() - window.getWidth()) / 2);
        int y = (int) ((dimension.getHeight() - window.getHeight()) / 2);
        window.setLocation(x, y);

        XYSeries series = new XYSeries("Humidity ");
        XYSeriesCollection dataset = new XYSeriesCollection(series);
        JFreeChart chart = ChartFactory.createXYLineChart("Humidity against Time", "Time(seconds)",
                "Humidity(percentage)", dataset);
        window.add(new ChartPanel(chart), BorderLayout.CENTER);
        window.setVisible(true);

    } catch (Exception e) {
        System.out.print("Chart exception:" + e);
    }
    initComponents();
}