Example usage for java.awt Color RED

List of usage examples for java.awt Color RED

Introduction

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

Prototype

Color RED

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

Click Source Link

Document

The color red.

Usage

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:SimpleBorder.java

public SimpleBorder() {
    this.top = 2;
    this.left = 4;
    this.bottom = 8;
    this.right = 10;
    this.color = Color.RED;
}

From source file:FillRectPanel.java

public void paintComponent(Graphics g) {
    super.paintComponent(g);
    g.drawRect(10, 10, 80, 30);//w w  w  .j a v  a2  s. c o m
    g.drawRoundRect(100, 10, 80, 30, 15, 15);
    g.drawOval(10, 100, 80, 30);
    g.setColor(Color.red);
    g.fillRect(10, 10, 80, 30);
    g.fillRoundRect(100, 10, 80, 30, 15, 15);

    int thickness = 4;

    g.fill3DRect(200, 10, 80, 30, true);
    for (int i = 1; i <= thickness; i++)
        g.draw3DRect(200 - i, 10 - i, 80 + 2 * i - 1, 30 + 2 * i - 1, true);

    g.fill3DRect(200, 50, 80, 30, false);
    for (int i = 1; i <= thickness; i++)
        g.draw3DRect(200 - i, 50 - i, 80 + 2 * i - 1, 30 + 2 * i - 1, true);

    g.fillOval(10, 100, 80, 30);
}

From source file:Main.java

public void paint(Graphics g) {
    g.fillRect(0, 0, 20, 20);//ww w .  j a v  a 2s .c  o  m

    Graphics2D g2 = (Graphics2D) g;

    g2.shear(5.3, 5.4);
    g2.rotate(30.0 * Math.PI / 180.0);

    g2.scale(2.0, 2.0);

    g.setColor(Color.red);

    g.fillRect(0, 0, 20, 20);
}

From source file:Main.java

public void paint(Graphics g) {
    g.fillRect(0, 0, 20, 20);/*from  w w  w . j  a  v  a2 s .com*/

    Graphics2D g2 = (Graphics2D) g;

    g2.translate(50, 50);
    g2.rotate(30.0 * Math.PI / 180.0);

    g2.scale(2.0, 2.0);

    g.setColor(Color.red);

    g.fillRect(0, 0, 20, 20);
}

From source file:Main.java

public void paint(Graphics g) {
    g.fillRect(0, 0, 20, 20);//from w  w w. j a  v  a  2s  .c o m

    Graphics2D g2 = (Graphics2D) g;

    g2.translate(5.3, 5.4);
    g2.rotate(30.0 * Math.PI / 180.0);

    g2.scale(2.0, 2.0);

    g.setColor(Color.red);

    g.fillRect(0, 0, 20, 20);
}

From source file:Main.java

public Main() {
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setSize(new Dimension(200, 200));
    add(label, BorderLayout.CENTER);
    setUndecorated(true);//from  ww  w .  j  av  a 2s .co  m
    getRootPane().setBorder(BorderFactory.createMatteBorder(4, 4, 4, 4, Color.RED));
    setVisible(true);

}

From source file:ImageProc.java

public static void imwrite(File file, int[][] classificationMat, int imgDim1, int imgDim2) {
    BufferedImage image = new BufferedImage(imgDim2, imgDim1, BufferedImage.TYPE_INT_RGB);

    for (int i = 0; i < imgDim1; i++) {
        for (int j = 0; j < imgDim2; j++) {

            switch (classificationMat[i][j]) {
            case 1:
                image.setRGB(j, i, Color.BLUE.getRGB());
                break;
            case 2:
                image.setRGB(j, i, Color.CYAN.getRGB());
                break;
            case 3:
                image.setRGB(j, i, Color.GREEN.getRGB());
                break;
            case 4:
                image.setRGB(j, i, Color.ORANGE.getRGB());
                break;
            case 5:
                image.setRGB(j, i, Color.RED.getRGB());
                break;
            }//from   w  w  w  .ja v a2  s  .co m
        }
    }
    try {
        ImageIO.write(image, "png", file);
    } catch (IOException e) {
        e.printStackTrace();
    }
}

From source file:Main.java

public Main() {
    getContentPane().setLayout(new FlowLayout());
    JLabel labelTwo = new JLabel("www.java2s.com");
    labelTwo.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.RAISED, Color.red, Color.black));

    add(labelTwo);//from   www .j a  v a  2s  .c o  m

    JLabel labelThree = new JLabel("MatteBorder");
    labelThree.setBorder(BorderFactory.createMatteBorder(10, 10, 10, 10, Color.pink));
    add(labelThree);

    JLabel labelFour = new JLabel("TitledBorder");
    labelFour.setBorder(
            BorderFactory.createTitledBorder(BorderFactory.createMatteBorder(10, 10, 10, 10, Color.pink),
                    "Title", TitledBorder.RIGHT, TitledBorder.BOTTOM));
    add(labelFour);

    JLabel labelSix = new JLabel("CompoundBorder");
    Border one = BorderFactory.createEtchedBorder();
    Border two = BorderFactory.createMatteBorder(4, 4, 4, 4, Color.blue);
    labelSix.setBorder(BorderFactory.createCompoundBorder(one, two));
    add(labelSix);

}

From source file:XORRectangles.java

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

    // using white as the XOR color.
    g2.setXORMode(Color.white);//  w w w  . j  a v  a2  s.  com
    // Paint a red rectangle.
    Rectangle2D r = new Rectangle2D.Double(50, 50, 150, 100);
    g2.setPaint(Color.red);
    g2.fill(r);
    g2.transform(AffineTransform.getTranslateInstance(25, 25));
    // Draw a blue rectangle.
    g2.setPaint(Color.blue);
    g2.fill(r);
}