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

public Main() {
    childPanel1.setBackground(Color.red);
    childPanel1.setPreferredSize(new Dimension(300, 40));
    childPanel2.setBackground(Color.blue);
    childPanel2.setPreferredSize(new Dimension(300, 40));
    childPanel3.setBackground(Color.yellow);
    childPanel3.setPreferredSize(new Dimension(300, 40));

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

From source file:XORPanel.java

public void paintComponent(Graphics g) {
    super.paintComponent(g);
    g.setColor(Color.red);/*from  w  w  w  .ja  v  a  2 s  . co m*/
    g.fillRect(10, 10, 80, 30);
    g.setColor(Color.green);
    g.fillRect(50, 20, 80, 30);
    g.setColor(Color.blue);
    g.fillRect(130, 40, 80, 30);
    g.setXORMode(Color.green);
    g.fillRect(90, 30, 80, 30);
}

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  ww  .  ja v  a  2  s.  c o m*/
    cb.setSelectedIcon(selected);
    cb.addItemListener(this);
    add(cb);

}

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("www.java2s.com", normal, true);
    cb.setRolloverIcon(rollover);//ww w. j  ava2  s.co  m
    cb.setSelectedIcon(selected);
    cb.addItemListener(this);
    add(cb);

}

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();
    cb.setRolloverIcon(rollover);/*from   ww  w.j a v  a  2s . c om*/
    cb.setSelectedIcon(selected);
    cb.addItemListener(this);
    add(cb);

}

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("www.java2s.com", normal);
    cb.setRolloverIcon(rollover);//from   w w w .j  a  v a  2  s  .c o  m
    cb.setSelectedIcon(selected);
    cb.addItemListener(this);
    add(cb);

}

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);
    cb.setRolloverIcon(rollover);//  w ww. ja  v  a 2s. com
    cb.setSelectedIcon(selected);
    cb.addItemListener(this);
    add(cb);

}

From source file:BasicStrokeDemo.java

public void paint(Graphics g) {
    Graphics2D g2 = (Graphics2D) g;
    g2.setStroke(new BasicStroke(3.0f));
    g2.setPaint(Color.blue);

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

    g2.draw(r);/*ww w. ja v  a 2 s . c o m*/
}

From source file:ThickStrokeDemo.java

public void paint(Graphics g) {
    Graphics2D g2 = (Graphics2D) g;
    g2.setStroke(new BasicStroke(8.0f));
    g2.setPaint(Color.blue);

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

    g2.draw(r);/*from   ww  w  . j  a  va2s.  c o m*/
}

From source file:MainClass.java

public MainClass() {
    // 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("www.java2s.com", normal);
    cb.setRolloverIcon(rollover);//from   ww w.  j a  v  a 2  s .c  om
    cb.setSelectedIcon(selected);
    cb.addItemListener(this);
    add(cb);

}