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

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

    Graphics2D g2 = (Graphics2D) g;

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

    g2.scale(2.0, 2.0);

    g.setColor(Color.red);

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

From source file:Main.java

public Main() {
    Object[] items = { Color.red, Color.green, Color.blue };
    JComboBox comboBox = new JComboBox(items);
    comboBox.setRenderer(new ColorRenderer(comboBox));
    getContentPane().add(comboBox, BorderLayout.NORTH);
    add(new JTextField(), BorderLayout.SOUTH);
}

From source file:MainClass.java

public static void pictureCircles(float x, float y, PdfContentByte cb) {
    cb.setColorFill(Color.red);
    cb.circle(x + 70, y + 70, 50);/*from w w w. j a  v a2  s  .com*/
    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 Main(String name) {
    getContentPane().setLayout(new FlowLayout());
    JLabel labelTwo = new JLabel("www.java2s.com");
    labelTwo.setBorder(BorderFactory.createStrokeBorder(new BasicStroke(0), Color.red));

    add(labelTwo);/*www  .j  a va 2 s. c  o m*/

}

From source file:MainClass.java

public void paint(Graphics g) {

    g.fillRect(0, 0, 20, 20);/*from  w  w w . ja  v a2s .  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 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 w  w  .j a  v a 2  s  .c  o  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:Main.java

public Main(String name) {
    getContentPane().setLayout(new FlowLayout());
    JLabel labelTwo = new JLabel("www.java2s.com");
    labelTwo.setBorder(BorderFactory.createSoftBevelBorder(BevelBorder.RAISED, Color.red, Color.black));
    add(labelTwo);/*  w  w w  .  j  a va  2s .  c o  m*/
}

From source file:Main.java

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

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

}

From source file:Main.java

public Main() {
    box.setBackground(Color.RED);
    box.addFocusListener(getFocusListener());
    JTextField f = new JTextField();
    add(box, BorderLayout.SOUTH);
    add(f, BorderLayout.NORTH);/*  w w w. ja v  a2 s .c  om*/
    pack();
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setVisible(true);
}

From source file:Main.java

public Main() {
    // Add check boxes to the content pane.
    Icon normal = new MyIcon(Color.red);
    Icon rollover = new MyIcon(Color.YELLOW);
    Icon selected = new MyIcon(Color.BLUE);

    JCheckBox cb = new JCheckBox(normal, true);
    cb.setRolloverIcon(rollover);/* w w w . j  a va2 s.  c o m*/
    cb.setSelectedIcon(selected);
    cb.addItemListener(this);
    add(cb);

}